Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 57423a7

Browse files
committedJun 23, 2024·
Remove redundancy in resolve error between main message and primary label
``` error[E0576]: cannot find method or associated constant `BAR` --> $DIR/issue-87638.rs:20:27 | LL | let _ = <S as Trait>::BAR; | ^^^ not found in trait `Trait` ``` instead of ``` error[E0576]: cannot find method or associated constant `BAR` in trait `Trait` --> $DIR/issue-87638.rs:20:27 | LL | let _ = <S as Trait>::BAR; | ^^^ not found in `Trait` ``` The general rule is that the primary span label should work well on its own (suitable to be shown in editors), while the main message provides additional context of the general case. When using `--error-format=short`, we concatenate the main message and the primary labels, so they should be complementary.
1 parent 33422e7 commit 57423a7

File tree

735 files changed

+1571
-1571
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

735 files changed

+1571
-1571
lines changed
 

‎compiler/rustc_resolve/src/late/diagnostics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,11 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
347347
} else {
348348
suggestion
349349
};
350-
(format!("not found in {mod_str}"), override_suggestion)
350+
(format!("not found in {mod_prefix}{mod_str}"), override_suggestion)
351351
};
352352

353353
BaseError {
354-
msg: format!("cannot find {expected} `{item_str}` in {mod_prefix}{mod_str}"),
354+
msg: format!("cannot find {expected} `{item_str}`"),
355355
fallback_label,
356356
span: item_span,
357357
span_label,

‎src/tools/clippy/tests/ui/crashes/ice-6252.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0412]: cannot find type `PhantomData` in this scope
1+
error[E0412]: cannot find type `PhantomData`
22
--> tests/ui/crashes/ice-6252.rs:9:9
33
|
44
LL | _n: PhantomData,
@@ -9,7 +9,7 @@ help: consider importing this struct
99
LL + use std::marker::PhantomData;
1010
|
1111

12-
error[E0412]: cannot find type `VAL` in this scope
12+
error[E0412]: cannot find type `VAL`
1313
--> tests/ui/crashes/ice-6252.rs:11:63
1414
|
1515
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}

0 commit comments

Comments
 (0)
Please sign in to comment.