Skip to content

Commit 95b6e07

Browse files
committed
Auto merge of #106399 - estebank:type-err-span-label, r=nagisa
Modify primary span label for E0308 Looking at the reactions to https://hachyderm.io/`@ekuber/109622160673605438,` a lot of people seem to have trouble understanding the current output, where the primary span label on type errors talks about the specific types that diverged, but these can be deeply nested type parameters. Because of that we could see "expected i32, found u32" in the label while the note said "expected Vec<i32>, found Vec<u32>". This understandably confuses people. I believe that once people learn to read these errors it starts to make more sense, but this PR changes the output to be more in line with what people might expect, without sacrificing terseness. Fix #68220.
2 parents 7242aeb + 5e392c2 commit 95b6e07

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/ui/track-diagnostics.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
22
--> $DIR/track-diagnostics.rs:LL:CC
33
|
44
LL | const S: A = B;
5-
| ^ expected struct `A`, found struct `B`
5+
| ^ expected `A`, found `B`
66
-Ztrack-diagnostics: created at compiler/rustc_infer/src/infer/error_reporting/mod.rs:LL:CC
77

88
error: aborting due to previous error

0 commit comments

Comments
 (0)