Unify wording of resolve error by estebank · Pull Request #145399 · rust-lang/rust (original) (raw)
Remove "failed to resolve" from the main error message 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`
The intent behind this is to end up with all resolve errors eventually be on the form of
error[ECODE]: cannot find `{NAME}` in {SCOPE}
--> $DIR/file.rs:5:13
|
LL | #[existent::nonexistent]
| ^^^^^^^^^^^ {SPECIFIC LABEL}
A category of errors that is interest are those that involve keywords. For example:
error[E0433]: cannot find `Self` in this scope
--> $DIR/issue-97194.rs:2:35
|
LL | fn bget(&self, index: [usize; Self::DIM]) -> bool {
| ^^^^ `Self` is only available in impls, traits, and type definitions
and
error[E0433]: cannot find `super` in this scope
--> $DIR/keyword-super.rs:2:9
|
LL | let super: isize;
| ^^^^^ there are too many leading `super` keywords
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.