-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #111477 - y21:extra-impl-in-trait-impl, r=compiler-er…
…rors better diagnostics for `impl<..> impl Trait for Type` Fixes #109963
- Loading branch information
Showing
6 changed files
with
97 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// run-rustfix | ||
|
||
struct S<T>(T); | ||
struct S2; | ||
|
||
impl<T: Default> Default for S<T> { | ||
//~^ ERROR: unexpected `impl` keyword | ||
//~| HELP: remove the extra `impl` | ||
fn default() -> Self { todo!() } | ||
} | ||
|
||
impl Default for S2 { | ||
//~^ ERROR: unexpected `impl` keyword | ||
//~| HELP: remove the extra `impl` | ||
fn default() -> Self { todo!() } | ||
} | ||
|
||
|
||
fn main() {} |
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,19 @@ | ||
// run-rustfix | ||
|
||
struct S<T>(T); | ||
struct S2; | ||
|
||
impl<T: Default> impl Default for S<T> { | ||
//~^ ERROR: unexpected `impl` keyword | ||
//~| HELP: remove the extra `impl` | ||
fn default() -> Self { todo!() } | ||
} | ||
|
||
impl impl Default for S2 { | ||
//~^ ERROR: unexpected `impl` keyword | ||
//~| HELP: remove the extra `impl` | ||
fn default() -> Self { todo!() } | ||
} | ||
|
||
|
||
fn main() {} |
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,26 @@ | ||
error: unexpected `impl` keyword | ||
--> $DIR/extra-impl-in-trait-impl.rs:6:18 | ||
| | ||
LL | impl<T: Default> impl Default for S<T> { | ||
| ^^^^^ help: remove the extra `impl` | ||
| | ||
note: this is parsed as an `impl Trait` type, but a trait is expected at this position | ||
--> $DIR/extra-impl-in-trait-impl.rs:6:18 | ||
| | ||
LL | impl<T: Default> impl Default for S<T> { | ||
| ^^^^^^^^^^^^ | ||
|
||
error: unexpected `impl` keyword | ||
--> $DIR/extra-impl-in-trait-impl.rs:12:6 | ||
| | ||
LL | impl impl Default for S2 { | ||
| ^^^^^ help: remove the extra `impl` | ||
| | ||
note: this is parsed as an `impl Trait` type, but a trait is expected at this position | ||
--> $DIR/extra-impl-in-trait-impl.rs:12:6 | ||
| | ||
LL | impl impl Default for S2 { | ||
| ^^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|