-
Notifications
You must be signed in to change notification settings - Fork 14k
Merge E0412 into E0425 #148678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
xonx4l
wants to merge
3
commits into
rust-lang:master
Choose a base branch
from
xonx4l:EO412_replacement_with_EO425
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+555
−626
Open
Merge E0412 into E0425 #148678
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,64 +1,6 @@ | ||
| A used type name is not in scope. | ||
| This error code is no longer emitted by the compiler. | ||
|
|
||
| Erroneous code examples: | ||
| Unresolved types are now reported under the unified error code E0425 | ||
| ("cannot find ... in this scope"). | ||
|
|
||
| ```compile_fail,E0412 | ||
| impl Something {} // error: type name `Something` is not in scope | ||
| // or: | ||
| trait Foo { | ||
| fn bar(N); // error: type name `N` is not in scope | ||
| } | ||
| // or: | ||
| fn foo(x: T) {} // type name `T` is not in scope | ||
| ``` | ||
|
|
||
| To fix this error, please verify you didn't misspell the type name, you did | ||
| declare it or imported it into the scope. Examples: | ||
|
|
||
| ``` | ||
| struct Something; | ||
| impl Something {} // ok! | ||
| // or: | ||
| trait Foo { | ||
| type N; | ||
| fn bar(_: Self::N); // ok! | ||
| } | ||
| // or: | ||
| fn foo<T>(x: T) {} // ok! | ||
| ``` | ||
|
|
||
| Another case that causes this error is when a type is imported into a parent | ||
| module. To fix this, you can follow the suggestion and use File directly or | ||
| `use super::File;` which will import the types from the parent namespace. An | ||
| example that causes this error is below: | ||
|
|
||
| ```compile_fail,E0412 | ||
| use std::fs::File; | ||
| mod foo { | ||
| fn some_function(f: File) {} | ||
| } | ||
| ``` | ||
|
|
||
| ``` | ||
| use std::fs::File; | ||
| mod foo { | ||
| // either | ||
| use super::File; | ||
| // or | ||
| // use std::fs::File; | ||
| fn foo(f: File) {} | ||
| } | ||
| # fn main() {} // don't insert it for us; that'll break imports | ||
| ``` | ||
| See the explanation for E0425 for guidance on common causes and fixes. | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -622,7 +622,7 @@ impl PathSource<'_, '_, '_> { | |
| (PathSource::Trait(_), true) => E0404, | ||
| (PathSource::Trait(_), false) => E0405, | ||
| (PathSource::Type | PathSource::DefineOpaques, true) => E0573, | ||
| (PathSource::Type | PathSource::DefineOpaques, false) => E0412, | ||
| (PathSource::Type | PathSource::DefineOpaques, false) => E0425, | ||
| (PathSource::Struct(_), true) => E0574, | ||
| (PathSource::Struct(_), false) => E0422, | ||
| (PathSource::Expr(..), true) | (PathSource::Delegation, true) => E0423, | ||
|
|
@@ -3158,7 +3158,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { | |
| result | ||
| } | ||
|
|
||
| /// When evaluating a `trait` use its associated types' idents for suggestions in E0412. | ||
| /// When evaluating a `trait` use its associated types' idents for suggestions in E0425. | ||
| fn resolve_trait_items(&mut self, trait_items: &'ast [Box<AssocItem>]) { | ||
| let trait_assoc_items = | ||
| replace(&mut self.diag_metadata.current_trait_assoc_items, Some(trait_items)); | ||
|
|
@@ -4342,15 +4342,15 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { | |
|
|
||
| // There are two different error messages user might receive at | ||
| // this point: | ||
| // - E0412 cannot find type `{}` in this scope | ||
| // - E0425 cannot find `{}` in this scope | ||
| // - E0433 failed to resolve: use of undeclared type or module `{}` | ||
| // | ||
| // The first one is emitted for paths in type-position, and the | ||
| // latter one - for paths in expression-position. | ||
| // | ||
| // Thus (since we're in expression-position at this point), not to | ||
| // confuse the user, we want to keep the *message* from E0433 (so | ||
| // `parent_err`), but we want *hints* from E0412 (so `err`). | ||
| // `parent_err`), but we want *hints* from the unified E0425 (so `err`). | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just |
||
| // | ||
| // And that's what happens below - we're just mixing both messages | ||
| // into a single one. | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| error[E0412]: cannot find type `PEB` in this scope | ||
| error[E0425]: cannot find type `PEB` in this scope | ||
| --> $DIR/issue-113788.rs:5:21 | ||
| | | ||
| LL | let peb: *const PEB; | ||
| | ^^^ not found in this scope | ||
|
|
||
| error: aborting due to 1 previous error | ||
|
|
||
| For more information about this error, try `rustc --explain E0412`. | ||
| For more information about this error, try `rustc --explain E0425`. |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
4 changes: 2 additions & 2 deletions
4
tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.stderr
This file contains hidden or 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 |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| error[E0412]: cannot find type `Missing` in this scope | ||
| error[E0425]: cannot find type `Missing` in this scope | ||
| --> $DIR/return-not-existing-type-wrapping-rpitit.rs:7:25 | ||
| | | ||
| LL | fn bar() -> Wrapper<Missing<impl Sized>>; | ||
| | ^^^^^^^ not found in this scope | ||
|
|
||
| error: aborting due to 1 previous error | ||
|
|
||
| For more information about this error, try `rustc --explain E0412`. | ||
| For more information about this error, try `rustc --explain E0425`. |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| error[E0412]: cannot find type `Missing` in this scope | ||
| error[E0425]: cannot find type `Missing` in this scope | ||
| --> $DIR/unconstrained-lifetimes.rs:6:17 | ||
| | | ||
| LL | async fn foo(_: Missing<'_>) {} | ||
| | ^^^^^^^ not found in this scope | ||
|
|
||
| error: aborting due to 1 previous error | ||
|
|
||
| For more information about this error, try `rustc --explain E0412`. | ||
| For more information about this error, try `rustc --explain E0425`. |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| error[E0412]: cannot find type `Missing` in this scope | ||
| error[E0425]: cannot find type `Missing` in this scope | ||
| --> $DIR/bad-drop-side-effects.rs:7:16 | ||
| | | ||
| LL | impl<U> B for &Missing { | ||
| | ^^^^^^^ not found in this scope | ||
|
|
||
| error: aborting due to 1 previous error | ||
|
|
||
| For more information about this error, try `rustc --explain E0412`. | ||
| For more information about this error, try `rustc --explain E0425`. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add note on the top is good enough, see E0001.md for an example.