Rollup merge of #145399 - estebank:resolve-error-wording-2, r=petrochenkov
Unify wording of resolve error
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 https://github.com/rust-lang/rust/pull/126810 and https://github.com/rust-lang/rust/pull/128086, a subset of the intended changes there with review comments applied.
r? @petrochenkov
This commit is contained in:
commit
efbc8957a6
249 changed files with 820 additions and 698 deletions
|
|
@ -2,7 +2,7 @@ struct Foo(isize, isize, isize, isize);
|
|||
|
||||
pub fn main() {
|
||||
let Self::anything_here_kills_it(a, b, ..) = Foo(5, 5, 5, 5);
|
||||
//~^ ERROR: failed to resolve
|
||||
//~^ ERROR: cannot find `Self` in this scope
|
||||
match [5, 5, 5, 5] {
|
||||
[..] => {},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions
|
||||
error[E0433]: cannot find `Self` in this scope
|
||||
--> tests/ui/crashes/unreachable-array-or-slice.rs:4:9
|
||||
|
|
||||
LL | let Self::anything_here_kills_it(a, b, ..) = Foo(5, 5, 5, 5);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ struct Struct<T>(T);
|
|||
impl<T> std::ops::Deref for Struct<T> {
|
||||
type Target = dyn Fn(T);
|
||||
fn deref(&self) -> &assert_mem_uninitialized_valid::Target {
|
||||
//~^ERROR: use of unresolved module or unlinked crate
|
||||
//~^ERROR: cannot find module or crate `assert_mem_uninitialized_valid` in this scope
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `assert_mem_uninitialized_valid`
|
||||
error[E0433]: cannot find module or crate `assert_mem_uninitialized_valid` in this scope
|
||||
--> tests/fail/rustc-error2.rs:LL:CC
|
||||
|
|
||||
LL | fn deref(&self) -> &assert_mem_uninitialized_valid::Target {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue