-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Unify wording of resolve error #145399
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?
Unify wording of resolve error #145399
Conversation
This PR modifies |
This comment has been minimized.
This comment has been minimized.
fd49d2a
to
298dec7
Compare
@@ -1,4 +1,4 @@ | |||
error[E0433]: failed to resolve: partially resolved path in a macro | |||
error[E0433]: cannot find `bar` in `Foo` | |||
--> $DIR/extern-macro.rs:5:13 | |||
| | |||
LL | let _ = Foo::bar!(); |
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 is a diagnostic that needs improvement regardless: we need to explain that Foo
is a type and that macros can't be in them. It would be particularly bad if Foo
had an associated item bar
as well.
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.
Changed the output to be
error[E0433]: cannot find macro `bar` in enum `Foo`
--> $DIR/extern-macro.rs:5:13
|
LL | let _ = Foo::bar!();
| ^^^^^^^^ a macro can't exist within an enum
Not perfect, but I feel it's more informative than we used to be.
@@ -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 `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.
Ah, I found I'd opened a separate PR already with some of these changes, and you had a comment about this change in particular
I agree that this isn't an improvement, but the primary label does still mention the intended issue. I'll see over the weekend what I can do about this.
This comment has been minimized.
This comment has been minimized.
Remove "failed to resolve" and use the same format we use in other resolution errors "cannot find `name`". ``` error[E0433]: cannot find `nonexistent` in `existent` --> $DIR/custom_attr_multisegment_error.rs:5:13 | LL | #[existent::nonexistent] | ^^^^^^^^^^^ could not find `nonexistent` in `existent` ```
298dec7
to
0b0bd12
Compare
0b0bd12
to
f6ce33d
Compare
error[E0433]: cannot find derive macro `Anything` in trait `Foo` | ||
--> $DIR/issue-46101.rs:2:10 | ||
| | ||
LL | #[derive(Foo::Anything)] | ||
| ^^^^^^^^^^^^^ partially resolved path in a derive macro | ||
| ^^^^^^^^^^^^^ a derive macro can't exist within a trait |
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.
Let me know if there's a wording you'd prefer for the label. I want to communicate the impossibility of the macro being in ADTs and traits in the first place.
The job Click to see the possible cause of the failure (guessed by this bot)
|
Remove "failed to resolve" from the main error message and use the same format we use in other resolution errors "cannot find
name
":The intent behind this is to end up with all resolve errors eventually be on the form of
A category of errors that is interest are those that involve keywords. For example:
and
For these the label provides the actual help, while the message is less informative beyond telling you "couldn't find
name
".This is an off-shoot of #126810 and #128086, a subset of the intended changes there with review comments applied.
r? @petrochenkov