Skip to content

Commit a86ca13

Browse files
authored
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 rust-lang/rust#126810 and rust-lang/rust#128086, a subset of the intended changes there with review comments applied. r? @petrochenkov
2 parents 0d092c8 + 6c1043e commit a86ca13

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

tests/fail/rustc-error2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ struct Struct<T>(T);
44
impl<T> std::ops::Deref for Struct<T> {
55
type Target = dyn Fn(T);
66
fn deref(&self) -> &assert_mem_uninitialized_valid::Target {
7-
//~^ERROR: use of unresolved module or unlinked crate
7+
//~^ERROR: cannot find module or crate `assert_mem_uninitialized_valid` in this scope
88
unimplemented!()
99
}
1010
}

tests/fail/rustc-error2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `assert_mem_uninitialized_valid`
1+
error[E0433]: cannot find module or crate `assert_mem_uninitialized_valid` in this scope
22
--> tests/fail/rustc-error2.rs:LL:CC
33
|
44
LL | fn deref(&self) -> &assert_mem_uninitialized_valid::Target {

0 commit comments

Comments
 (0)