-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Unify wording of "failed to resolve" errors with "cannot find" resolution errors #128086
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
base: master
Are you sure you want to change the base?
Conversation
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
Split off from #126810. "Hide whitespace" will aid in seeing mostly "true" changes. The amount of files being touched is a consequence of the blast radius the diagnostic has. Happy to hear about other potential alternatives for what the output should be instead. |
This comment has been minimized.
This comment has been minimized.
Blocking on the wording discussion in #128080 (comment). |
This comment was marked as resolved.
This comment was marked as resolved.
Reminder, once the PR becomes ready for a review, use |
2abb31d
to
b32d0e7
Compare
This comment has been minimized.
This comment has been minimized.
b32d0e7
to
c397b99
Compare
This comment was marked as resolved.
This comment was marked as resolved.
…tion errors * Use the same wording for all macro resolution errors * specify the scope in which the resolution failure happened Before ``` error[E0433]: failed to resolve: `crate` in paths can only be used in start position --> $DIR/crate-path-non-absolute.rs:5:22 | LL | let s = ::m::crate::S; | ^^^^^ `crate` in paths can only be used in start position ``` after ``` error[E0433]: cannot find module `crate` in module `m` --> $DIR/crate-path-non-absolute.rs:5:22 | LL | let s = ::m::crate::S; | ^^^^^ `crate` in paths can only be used in start position ```
c397b99
to
fa24625
Compare
The job Click to see the possible cause of the failure (guessed by this bot)
|
@@ -1,4 +1,4 @@ | |||
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `r#mod` | |||
error[E0433]: cannot find item `mod` in this scope |
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.
error[E0433]: cannot find item `mod` in this scope | |
error[E0433]: cannot find item `mod` in the crate root |
r#mod
in crate::r#mod
is not resolved in the current scope.
@@ -1,4 +1,4 @@ | |||
error[E0433]: failed to resolve: partially resolved path in a macro | |||
error[E0433]: cannot find macro `bar` in this scope |
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.
error[E0433]: cannot find macro `bar` in this scope | |
error[E0433]: cannot find macro `bar` in enum `Foo` |
@@ -1,14 +1,14 @@ | |||
error[E0433]: failed to resolve: partially resolved path in a derive macro | |||
error[E0433]: cannot find macro `Anything` in this scope |
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.
error[E0433]: cannot find macro `Anything` in this scope | |
error[E0433]: cannot find macro `Anything` in trait `Foo` |
| ^^^^^ there are too many leading `super` keywords | ||
| ^^^^^ can't use `super` as an identifier | ||
| | ||
help: if you still want to call your identifier `super`, use the raw identifier format |
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.
Path segment keywords (is_path_segment_keyword
) like self
or super
cannot be raw identifiers.
@@ -1,4 +1,4 @@ | |||
error[E0433]: failed to resolve: partially resolved path in a macro | |||
error[E0433]: cannot find macro `Ok` in this scope |
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.
error[E0433]: cannot find macro `Ok` in this scope | |
error[E0433]: cannot find macro `Ok` in enum `Result` |
@@ -58,7 +58,7 @@ extern crate macro_helpers as _; | |||
/* lang and libs implicitly in scope */ | |||
|
|||
// tool/extern -> extern | |||
#[type_ns::inner] //~ ERROR could not find `inner` in `type_ns` | |||
#[type_ns::inner] //~ ERROR cannot find macro `inner` in crate `macro_helpers` |
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.
#[type_ns::inner] //~ ERROR cannot find macro `inner` in crate `macro_helpers` | |
#[type_ns::inner] //~ ERROR cannot find macro `inner` in crate `type_ns` |
would be preferable, although I'm not sure.
@@ -16,7 +16,7 @@ error[E0742]: visibilities can only be restricted to ancestor modules | |||
LL | pub(in std::vec) struct F; | |||
| ^^^^^^^^ | |||
|
|||
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nonexistent` | |||
error[E0433]: cannot find item `nonexistent` in this scope |
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.
error[E0433]: cannot find item `nonexistent` in this scope | |
error[E0433]: cannot find item `nonexistent` in the crate root |
This is 2015 edition, so imports and visibilities are resolved in the root module.
@@ -1,4 +1,4 @@ | |||
error[E0433]: failed to resolve: `String` is a struct, not a module | |||
error[E0433]: cannot find module `String` in this scope |
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.
error[E0433]: cannot find module `String` in this scope | |
error[E0433]: cannot find module `String` in module `string` |
@@ -41,7 +41,7 @@ LL - bar: st::cell::Cell<bool> | |||
LL + bar: cell::Cell<bool> | |||
| | |||
|
|||
error[E0433]: failed to resolve: function `bar` is not a crate or module | |||
error[E0433]: cannot find item `bar` in this scope |
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.
You can find bar
, but it's a function and not a module, the previous error told about that.
format!( | ||
"partially resolved path in {} {}", | ||
kind.article(), | ||
kind.descr() |
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.
This could give a more precise description, like "attribute macro" or "derive macro".
Before
after
r? @petrochenkov