-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 #88899 - FabianWolff:issue-88844, r=matthewjasper
Do not issue E0071 if a type error has already been reported Fixes #88844. A suggested fix is already included in the error message for E0412, so with my changes, E0071 is simply not emitted anymore if the type in question is a "type error". This makes sense, I think, because we cannot confidently state that something is "not a struct" if we couldn't resolve it properly; and it's unnecessary to pollute the output with this additional error message, as it is a direct consequence of the former error. I have also addressed the issue mentioned in #88844 (comment) by changing the fixed example in the documentation to more closely match the erroneous code example.
- Loading branch information
Showing
4 changed files
with
52 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Regression test for #88844. | ||
|
||
struct Struct { value: i32 } | ||
//~^ NOTE: similarly named struct `Struct` defined here | ||
|
||
impl Stuct { | ||
//~^ ERROR: cannot find type `Stuct` in this scope [E0412] | ||
//~| HELP: a struct with a similar name exists | ||
fn new() -> Self { | ||
Self { value: 42 } | ||
} | ||
} | ||
|
||
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,12 @@ | ||
error[E0412]: cannot find type `Stuct` in this scope | ||
--> $DIR/issue-88844.rs:6:6 | ||
| | ||
LL | struct Struct { value: i32 } | ||
| ------------- similarly named struct `Struct` defined here | ||
... | ||
LL | impl Stuct { | ||
| ^^^^^ help: a struct with a similar name exists: `Struct` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0412`. |