forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#120417 - matthiaskrgr:rollup-5rszkmd, r=matth…
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#118182 (Properly recover from trailing attr in body) - rust-lang#119641 (Remove feature not required by `Ipv6Addr::to_cononical` doctest) - rust-lang#119957 (fix: correct suggestion arg for impl trait) - rust-lang#120386 (ScopeTree: remove destruction_scopes as unused) - rust-lang#120398 (Improve handling of numbers in `IntoDiagnosticArg`) - rust-lang#120399 (Remove myself from review rotation) r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
11 changed files
with
213 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Issue #118164: recovery path leaving unemitted error behind | ||
fn bar() -> String { | ||
#[cfg(feature = )] | ||
[1, 2, 3].iter().map().collect::<String>() //~ ERROR expected `;`, found `#` | ||
#[attr] //~ ERROR expected statement after outer attribute | ||
} | ||
fn main() { | ||
let _ = bar(); | ||
} |
27 changes: 27 additions & 0 deletions
27
tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
error: expected `;`, found `#` | ||
--> $DIR/properly-recover-from-trailing-outer-attribute-in-body.rs:4:47 | ||
| | ||
LL | #[cfg(feature = )] | ||
| ------------------ only `;` terminated statements or tail expressions are allowed after this attribute | ||
LL | [1, 2, 3].iter().map().collect::<String>() | ||
| ^ expected `;` here | ||
LL | #[attr] | ||
| - unexpected token | ||
| | ||
help: add `;` here | ||
| | ||
LL | [1, 2, 3].iter().map().collect::<String>(); | ||
| + | ||
help: alternatively, consider surrounding the expression with a block | ||
| | ||
LL | { [1, 2, 3].iter().map().collect::<String>() } | ||
| + + | ||
|
||
error: expected statement after outer attribute | ||
--> $DIR/properly-recover-from-trailing-outer-attribute-in-body.rs:5:5 | ||
| | ||
LL | #[attr] | ||
| ^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
29 changes: 29 additions & 0 deletions
29
tests/ui/suggestions/suggest-assoc-fn-call-for-impl-trait.fixed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// run-rustfix | ||
|
||
struct A { | ||
|
||
} | ||
|
||
trait M { | ||
fn foo(_a: Self); | ||
fn bar(_a: Self); | ||
fn baz(_a: i32); | ||
} | ||
|
||
impl M for A { | ||
fn foo(_a: Self) {} | ||
fn bar(_a: A) {} | ||
fn baz(_a: i32) {} | ||
} | ||
|
||
fn main() { | ||
let _a = A {}; | ||
A::foo(_a); | ||
//~^ ERROR no method named `foo` found | ||
A::baz(0); | ||
//~^ ERROR no method named `baz` found | ||
|
||
let _b = A {}; | ||
A::bar(_b); | ||
//~^ ERROR no method named `bar` found | ||
} |
29 changes: 29 additions & 0 deletions
29
tests/ui/suggestions/suggest-assoc-fn-call-for-impl-trait.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// run-rustfix | ||
|
||
struct A { | ||
|
||
} | ||
|
||
trait M { | ||
fn foo(_a: Self); | ||
fn bar(_a: Self); | ||
fn baz(_a: i32); | ||
} | ||
|
||
impl M for A { | ||
fn foo(_a: Self) {} | ||
fn bar(_a: A) {} | ||
fn baz(_a: i32) {} | ||
} | ||
|
||
fn main() { | ||
let _a = A {}; | ||
_a.foo(); | ||
//~^ ERROR no method named `foo` found | ||
_a.baz(0); | ||
//~^ ERROR no method named `baz` found | ||
|
||
let _b = A {}; | ||
_b.bar(); | ||
//~^ ERROR no method named `bar` found | ||
} |
60 changes: 60 additions & 0 deletions
60
tests/ui/suggestions/suggest-assoc-fn-call-for-impl-trait.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
error[E0599]: no method named `foo` found for struct `A` in the current scope | ||
--> $DIR/suggest-assoc-fn-call-for-impl-trait.rs:21:8 | ||
| | ||
LL | struct A { | ||
| -------- method `foo` not found for this struct | ||
... | ||
LL | _a.foo(); | ||
| ---^^^-- | ||
| | | | ||
| | this is an associated function, not a method | ||
| help: use associated function syntax instead: `A::foo(_a)` | ||
| | ||
= note: found the following associated functions; to be used as methods, functions must have a `self` parameter | ||
note: the candidate is defined in the trait `M` | ||
--> $DIR/suggest-assoc-fn-call-for-impl-trait.rs:8:5 | ||
| | ||
LL | fn foo(_a: Self); | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0599]: no method named `baz` found for struct `A` in the current scope | ||
--> $DIR/suggest-assoc-fn-call-for-impl-trait.rs:23:8 | ||
| | ||
LL | struct A { | ||
| -------- method `baz` not found for this struct | ||
... | ||
LL | _a.baz(0); | ||
| ---^^^--- | ||
| | | | ||
| | this is an associated function, not a method | ||
| help: use associated function syntax instead: `A::baz(0)` | ||
| | ||
= note: found the following associated functions; to be used as methods, functions must have a `self` parameter | ||
note: the candidate is defined in the trait `M` | ||
--> $DIR/suggest-assoc-fn-call-for-impl-trait.rs:10:5 | ||
| | ||
LL | fn baz(_a: i32); | ||
| ^^^^^^^^^^^^^^^^ | ||
|
||
error[E0599]: no method named `bar` found for struct `A` in the current scope | ||
--> $DIR/suggest-assoc-fn-call-for-impl-trait.rs:27:8 | ||
| | ||
LL | struct A { | ||
| -------- method `bar` not found for this struct | ||
... | ||
LL | _b.bar(); | ||
| ---^^^-- | ||
| | | | ||
| | this is an associated function, not a method | ||
| help: use associated function syntax instead: `A::bar(_b)` | ||
| | ||
= note: found the following associated functions; to be used as methods, functions must have a `self` parameter | ||
note: the candidate is defined in the trait `M` | ||
--> $DIR/suggest-assoc-fn-call-for-impl-trait.rs:9:5 | ||
| | ||
LL | fn bar(_a: Self); | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0599`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters