about summary refs log tree commit diff
path: root/tests/ui/track-diagnostics
diff options
context:
space:
mode:
authorScott Schafer <schaferjscott@gmail.com>2025-06-02 23:40:01 -0600
committerScott Schafer <schaferjscott@gmail.com>2025-07-03 07:19:25 -0600
commit6bef238b6346911d29a1ee0b067dc003da15f828 (patch)
treeac560f56261d7b5bfd3c0bdb285b9609b2fbb9d4 /tests/ui/track-diagnostics
parentd6120810e56387730b2e86115471354c8084ca4a (diff)
downloadrust-6bef238b6346911d29a1ee0b067dc003da15f828.tar.gz
rust-6bef238b6346911d29a1ee0b067dc003da15f828.zip
refactor: Make -Ztrack-diagnostics emit like a note
Diffstat (limited to 'tests/ui/track-diagnostics')
-rw-r--r--tests/ui/track-diagnostics/track.rs5
-rw-r--r--tests/ui/track-diagnostics/track.stderr8
-rw-r--r--tests/ui/track-diagnostics/track2.rs6
-rw-r--r--tests/ui/track-diagnostics/track2.stderr2
-rw-r--r--tests/ui/track-diagnostics/track3.rs4
-rw-r--r--tests/ui/track-diagnostics/track3.stderr6
-rw-r--r--tests/ui/track-diagnostics/track4.rs6
-rw-r--r--tests/ui/track-diagnostics/track4.stderr2
-rw-r--r--tests/ui/track-diagnostics/track5.rs6
-rw-r--r--tests/ui/track-diagnostics/track5.stderr3
-rw-r--r--tests/ui/track-diagnostics/track6.rs6
-rw-r--r--tests/ui/track-diagnostics/track6.stderr2
12 files changed, 37 insertions, 19 deletions
diff --git a/tests/ui/track-diagnostics/track.rs b/tests/ui/track-diagnostics/track.rs
index 78ff85489be..1b2558c724b 100644
--- a/tests/ui/track-diagnostics/track.rs
+++ b/tests/ui/track-diagnostics/track.rs
@@ -1,5 +1,5 @@
 //@ compile-flags: -Z track-diagnostics
-//@ error-pattern: created at
+//@ dont-require-annotations: NOTE
 //@ rustc-env:RUST_BACKTRACE=0
 //@ failure-status: 101
 
@@ -16,6 +16,9 @@
 fn main() {
     break rust
     //~^ ERROR cannot find value `rust` in this scope
+    //~| NOTE created at
     //~| ERROR `break` outside of a loop or labeled block
+    //~| NOTE created at
     //~| ERROR It looks like you're trying to break rust; would you like some ICE?
+    //~| NOTE created at
 }
diff --git a/tests/ui/track-diagnostics/track.stderr b/tests/ui/track-diagnostics/track.stderr
index 527c0d1b898..f82764958d4 100644
--- a/tests/ui/track-diagnostics/track.stderr
+++ b/tests/ui/track-diagnostics/track.stderr
@@ -3,22 +3,24 @@ error[E0425]: cannot find value `rust` in this scope
    |
 LL |     break rust
    |           ^^^^ not found in this scope
--Ztrack-diagnostics: created at compiler/rustc_resolve/src/late/diagnostics.rs:LL:CC
+   |
+   = note: -Ztrack-diagnostics: created at compiler/rustc_resolve/src/late/diagnostics.rs:LL:CC
 
 error[E0268]: `break` outside of a loop or labeled block
   --> $DIR/track.rs:LL:CC
    |
 LL |     break rust
    |     ^^^^^^^^^^ cannot `break` outside of a loop or labeled block
--Ztrack-diagnostics: created at compiler/rustc_hir_typeck/src/loops.rs:LL:CC
+   |
+   = note: -Ztrack-diagnostics: created at compiler/rustc_hir_typeck/src/loops.rs:LL:CC
 
 error: internal compiler error: It looks like you're trying to break rust; would you like some ICE?
   --> $DIR/track.rs:LL:CC
    |
 LL |     break rust
    |     ^^^^^^^^^^
--Ztrack-diagnostics: created at compiler/rustc_hir_typeck/src/lib.rs:LL:CC
    |
+   = note: -Ztrack-diagnostics: created at compiler/rustc_hir_typeck/src/lib.rs:LL:CC
    = note: the compiler expectedly panicked. this is a feature.
    = note: we would appreciate a joke overview: https://github.com/rust-lang/rust/issues/43162#issuecomment-320764675
    = note: rustc $VERSION running on $TARGET
diff --git a/tests/ui/track-diagnostics/track2.rs b/tests/ui/track-diagnostics/track2.rs
index f51a42cf86f..591b84f330b 100644
--- a/tests/ui/track-diagnostics/track2.rs
+++ b/tests/ui/track-diagnostics/track2.rs
@@ -1,10 +1,12 @@
 //@ compile-flags: -Z track-diagnostics
-//@ error-pattern: created at
+//@ dont-require-annotations: NOTE
 
 // Normalize the emitted location so this doesn't need
 // updating everytime someone adds or removes a line.
 //@ normalize-stderr: ".rs:\d+:\d+" -> ".rs:LL:CC"
 
 fn main() {
-    let _moved @ _from = String::from("foo"); //~ ERROR use of moved value
+    let _moved @ _from = String::from("foo");
+    //~^ ERROR use of moved value
+    //~| NOTE created at
 }
diff --git a/tests/ui/track-diagnostics/track2.stderr b/tests/ui/track-diagnostics/track2.stderr
index dffa0b0c91c..02010639c02 100644
--- a/tests/ui/track-diagnostics/track2.stderr
+++ b/tests/ui/track-diagnostics/track2.stderr
@@ -6,8 +6,8 @@ LL |     let _moved @ _from = String::from("foo");
    |         |        |
    |         |        value moved here
    |         value used here after move
--Ztrack-diagnostics: created at compiler/rustc_borrowck/src/borrowck_errors.rs:LL:CC
    |
+   = note: -Ztrack-diagnostics: created at compiler/rustc_borrowck/src/borrowck_errors.rs:LL:CC
 help: borrow this binding in the pattern to avoid moving the value
    |
 LL |     let ref _moved @ ref _from = String::from("foo");
diff --git a/tests/ui/track-diagnostics/track3.rs b/tests/ui/track-diagnostics/track3.rs
index 428067572af..a39e71915d9 100644
--- a/tests/ui/track-diagnostics/track3.rs
+++ b/tests/ui/track-diagnostics/track3.rs
@@ -1,5 +1,5 @@
 //@ compile-flags: -Z track-diagnostics
-//@ error-pattern: created at
+//@ dont-require-annotations: NOTE
 
 // Normalize the emitted location so this doesn't need
 // updating everytime someone adds or removes a line.
@@ -8,5 +8,7 @@
 fn main() {
     let _unimported = Blah { field: u8 };
     //~^ ERROR cannot find struct, variant or union type `Blah` in this scope
+    //~| NOTE created at
     //~| ERROR expected value, found builtin type `u8`
+    //~| NOTE created at
 }
diff --git a/tests/ui/track-diagnostics/track3.stderr b/tests/ui/track-diagnostics/track3.stderr
index dc468d7e8ee..3e99c8d5f33 100644
--- a/tests/ui/track-diagnostics/track3.stderr
+++ b/tests/ui/track-diagnostics/track3.stderr
@@ -3,14 +3,16 @@ error[E0422]: cannot find struct, variant or union type `Blah` in this scope
    |
 LL |     let _unimported = Blah { field: u8 };
    |                       ^^^^ not found in this scope
--Ztrack-diagnostics: created at compiler/rustc_resolve/src/late/diagnostics.rs:LL:CC
+   |
+   = note: -Ztrack-diagnostics: created at compiler/rustc_resolve/src/late/diagnostics.rs:LL:CC
 
 error[E0423]: expected value, found builtin type `u8`
   --> $DIR/track3.rs:LL:CC
    |
 LL |     let _unimported = Blah { field: u8 };
    |                                     ^^ not a value
--Ztrack-diagnostics: created at compiler/rustc_resolve/src/late/diagnostics.rs:LL:CC
+   |
+   = note: -Ztrack-diagnostics: created at compiler/rustc_resolve/src/late/diagnostics.rs:LL:CC
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/track-diagnostics/track4.rs b/tests/ui/track-diagnostics/track4.rs
index b6edfdba259..0038c616aa5 100644
--- a/tests/ui/track-diagnostics/track4.rs
+++ b/tests/ui/track-diagnostics/track4.rs
@@ -1,11 +1,13 @@
 //@ compile-flags: -Z track-diagnostics
-//@ error-pattern: created at
+//@ dont-require-annotations: NOTE
 
 // Normalize the emitted location so this doesn't need
 // updating everytime someone adds or removes a line.
 //@ normalize-stderr: ".rs:\d+:\d+" -> ".rs:LL:CC"
 
-pub onion { //~ ERROR missing `enum` for enum definition
+pub onion {
+    //~^ ERROR missing `enum` for enum definition
+    //~| NOTE created at
     Owo(u8),
     Uwu(i8),
 }
diff --git a/tests/ui/track-diagnostics/track4.stderr b/tests/ui/track-diagnostics/track4.stderr
index 19499fa7abc..2b6805849b5 100644
--- a/tests/ui/track-diagnostics/track4.stderr
+++ b/tests/ui/track-diagnostics/track4.stderr
@@ -3,8 +3,8 @@ error: missing `enum` for enum definition
    |
 LL | pub onion {
    | ^^^^^^^^^
--Ztrack-diagnostics: created at compiler/rustc_parse/src/parser/item.rs:LL:CC
    |
+   = note: -Ztrack-diagnostics: created at compiler/rustc_parse/src/parser/item.rs:LL:CC
 help: add `enum` here to parse `onion` as an enum
    |
 LL | pub enum onion {
diff --git a/tests/ui/track-diagnostics/track5.rs b/tests/ui/track-diagnostics/track5.rs
index 800bb21b2b1..09fda4eb527 100644
--- a/tests/ui/track-diagnostics/track5.rs
+++ b/tests/ui/track-diagnostics/track5.rs
@@ -1,8 +1,10 @@
 //@ compile-flags: -Z track-diagnostics
-//@ error-pattern: created at
+//@ dont-require-annotations: NOTE
 
 // Normalize the emitted location so this doesn't need
 // updating everytime someone adds or removes a line.
 //@ normalize-stderr: ".rs:\d+:\d+" -> ".rs:LL:CC"
 
-} //~ ERROR unexpected closing delimiter: `}`
+}
+//~^ ERROR unexpected closing delimiter: `}`
+//~| NOTE created at
diff --git a/tests/ui/track-diagnostics/track5.stderr b/tests/ui/track-diagnostics/track5.stderr
index ecc7d81b3c3..5de0550918e 100644
--- a/tests/ui/track-diagnostics/track5.stderr
+++ b/tests/ui/track-diagnostics/track5.stderr
@@ -3,7 +3,8 @@ error: unexpected closing delimiter: `}`
    |
 LL | }
    | ^ unexpected closing delimiter
--Ztrack-diagnostics: created at compiler/rustc_parse/src/lexer/tokentrees.rs:LL:CC
+   |
+   = note: -Ztrack-diagnostics: created at compiler/rustc_parse/src/lexer/tokentrees.rs:LL:CC
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/track-diagnostics/track6.rs b/tests/ui/track-diagnostics/track6.rs
index 55db2ecf939..11d3b7e9764 100644
--- a/tests/ui/track-diagnostics/track6.rs
+++ b/tests/ui/track-diagnostics/track6.rs
@@ -1,5 +1,5 @@
 //@ compile-flags: -Z track-diagnostics
-//@ error-pattern: created at
+//@ dont-require-annotations: NOTE
 
 // Normalize the emitted location so this doesn't need
 // updating everytime someone adds or removes a line.
@@ -11,7 +11,9 @@ pub trait Foo {
 }
 
 impl <T> Foo for T {
-    default fn bar() {} //~ ERROR specialization is unstable
+    default fn bar() {}
+    //~^ ERROR specialization is unstable
+    //~| NOTE created at
 }
 
 fn main() {}
diff --git a/tests/ui/track-diagnostics/track6.stderr b/tests/ui/track-diagnostics/track6.stderr
index 9ed8a19629d..a61f7855e32 100644
--- a/tests/ui/track-diagnostics/track6.stderr
+++ b/tests/ui/track-diagnostics/track6.stderr
@@ -3,8 +3,8 @@ error[E0658]: specialization is unstable
    |
 LL |     default fn bar() {}
    |     ^^^^^^^^^^^^^^^^^^^
--Ztrack-diagnostics: created at compiler/rustc_ast_passes/src/feature_gate.rs:LL:CC
    |
+   = note: -Ztrack-diagnostics: created at compiler/rustc_ast_passes/src/feature_gate.rs:LL:CC
    = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
    = help: add `#![feature(specialization)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date