refactor: Make -Ztrack-diagnostics emit like a note

This commit is contained in:
Scott Schafer 2025-06-02 23:40:01 -06:00
parent 45b32efc49
commit 7060377bfe
3 changed files with 5 additions and 3 deletions

View file

@ -3,8 +3,8 @@ error: casting to the same type is unnecessary (`u32` -> `u32`)
|
LL | let b = a as u32;
| ^^^^^^^^ help: try: `a`
-Ztrack-diagnostics: created at src/tools/clippy/clippy_lints/src/casts/unnecessary_cast.rs:LL:CC
|
= note: -Ztrack-diagnostics: created at src/tools/clippy/clippy_lints/src/casts/unnecessary_cast.rs:LL:CC
= note: `-D clippy::unnecessary-cast` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_cast)]`
@ -15,8 +15,8 @@ LL | let d = 42;
| ----------- unnecessary `let` binding
LL | d
| ^
-Ztrack-diagnostics: created at src/tools/clippy/clippy_lints/src/returns.rs:LL:CC
|
= note: -Ztrack-diagnostics: created at src/tools/clippy/clippy_lints/src/returns.rs:LL:CC
= note: `-D clippy::let-and-return` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::let_and_return)]`
help: return the expression directly

View file

@ -8,5 +8,6 @@ struct A;
struct B;
const S: A = B;
//~^ ERROR: mismatched types
//~| NOTE: created at
fn main() {}

View file

@ -3,7 +3,8 @@ error[E0308]: mismatched types
|
LL | const S: A = B;
| ^ expected `A`, found `B`
-Ztrack-diagnostics: created at compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:LL:CC
|
= note: -Ztrack-diagnostics: created at compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:LL:CC
error: aborting due to 1 previous error