summaryrefslogtreecommitdiffstats
path: root/src/test/ui/track-diagnostics
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/track-diagnostics')
-rw-r--r--src/test/ui/track-diagnostics/track.rs11
-rw-r--r--src/test/ui/track-diagnostics/track.stderr26
-rw-r--r--src/test/ui/track-diagnostics/track2.rs10
-rw-r--r--src/test/ui/track-diagnostics/track2.stderr18
-rw-r--r--src/test/ui/track-diagnostics/track3.rs10
-rw-r--r--src/test/ui/track-diagnostics/track3.stderr18
-rw-r--r--src/test/ui/track-diagnostics/track4.rs13
-rw-r--r--src/test/ui/track-diagnostics/track4.stderr14
-rw-r--r--src/test/ui/track-diagnostics/track5.rs8
-rw-r--r--src/test/ui/track-diagnostics/track5.stderr9
-rw-r--r--src/test/ui/track-diagnostics/track6.rs14
-rw-r--r--src/test/ui/track-diagnostics/track6.stderr13
12 files changed, 164 insertions, 0 deletions
diff --git a/src/test/ui/track-diagnostics/track.rs b/src/test/ui/track-diagnostics/track.rs
new file mode 100644
index 000000000..61b9137ea
--- /dev/null
+++ b/src/test/ui/track-diagnostics/track.rs
@@ -0,0 +1,11 @@
+// compile-flags: -Z track-diagnostics
+// error-pattern: created at
+
+// Normalize the emitted location so this doesn't need
+// updating everytime someone adds or removes a line.
+// normalize-stderr-test ".rs:\d+:\d+" -> ".rs:LL:CC"
+// normalize-stderr-test "note: rustc .+ running on .+" -> "note: rustc $$VERSION running on $$TARGET"
+
+fn main() {
+ break rust
+}
diff --git a/src/test/ui/track-diagnostics/track.stderr b/src/test/ui/track-diagnostics/track.stderr
new file mode 100644
index 000000000..8256c1f5f
--- /dev/null
+++ b/src/test/ui/track-diagnostics/track.stderr
@@ -0,0 +1,26 @@
+error[E0425]: cannot find value `rust` in this scope
+ --> $DIR/track.rs:LL:CC
+ |
+LL | break rust
+ | ^^^^ not found in this scope
+-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_passes/src/loops.rs:LL:CC
+
+error: internal compiler error: It looks like you're trying to break rust; would you like some ICE?
+
+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
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0268, E0425.
+For more information about an error, try `rustc --explain E0268`.
diff --git a/src/test/ui/track-diagnostics/track2.rs b/src/test/ui/track-diagnostics/track2.rs
new file mode 100644
index 000000000..dc105c61d
--- /dev/null
+++ b/src/test/ui/track-diagnostics/track2.rs
@@ -0,0 +1,10 @@
+// compile-flags: -Z track-diagnostics
+// error-pattern: created at
+
+// Normalize the emitted location so this doesn't need
+// updating everytime someone adds or removes a line.
+// normalize-stderr-test ".rs:\d+:\d+" -> ".rs:LL:CC"
+
+fn main() {
+ let _moved @ _from = String::from("foo");
+}
diff --git a/src/test/ui/track-diagnostics/track2.stderr b/src/test/ui/track-diagnostics/track2.stderr
new file mode 100644
index 000000000..fe13e5ef3
--- /dev/null
+++ b/src/test/ui/track-diagnostics/track2.stderr
@@ -0,0 +1,18 @@
+error[E0382]: use of moved value
+ --> $DIR/track2.rs:LL:CC
+ |
+LL | let _moved @ _from = String::from("foo");
+ | ^^^^^^ ----- ------------------- move occurs because value has type `String`, which does not implement the `Copy` trait
+ | | |
+ | | value moved here
+ | value used here after move
+-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");
+ | +++ +++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/track-diagnostics/track3.rs b/src/test/ui/track-diagnostics/track3.rs
new file mode 100644
index 000000000..069923950
--- /dev/null
+++ b/src/test/ui/track-diagnostics/track3.rs
@@ -0,0 +1,10 @@
+// compile-flags: -Z track-diagnostics
+// error-pattern: created at
+
+// Normalize the emitted location so this doesn't need
+// updating everytime someone adds or removes a line.
+// normalize-stderr-test ".rs:\d+:\d+" -> ".rs:LL:CC"
+
+fn main() {
+ let _unimported = Blah { field: u8 };
+}
diff --git a/src/test/ui/track-diagnostics/track3.stderr b/src/test/ui/track-diagnostics/track3.stderr
new file mode 100644
index 000000000..dc468d7e8
--- /dev/null
+++ b/src/test/ui/track-diagnostics/track3.stderr
@@ -0,0 +1,18 @@
+error[E0422]: cannot find struct, variant or union type `Blah` in this scope
+ --> $DIR/track3.rs:LL:CC
+ |
+LL | let _unimported = Blah { field: u8 };
+ | ^^^^ not found in this scope
+-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
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0422, E0423.
+For more information about an error, try `rustc --explain E0422`.
diff --git a/src/test/ui/track-diagnostics/track4.rs b/src/test/ui/track-diagnostics/track4.rs
new file mode 100644
index 000000000..35eec799b
--- /dev/null
+++ b/src/test/ui/track-diagnostics/track4.rs
@@ -0,0 +1,13 @@
+// compile-flags: -Z track-diagnostics
+// error-pattern: created at
+
+// Normalize the emitted location so this doesn't need
+// updating everytime someone adds or removes a line.
+// normalize-stderr-test ".rs:\d+:\d+" -> ".rs:LL:CC"
+
+pub onion {
+ Owo(u8),
+ Uwu(i8),
+}
+
+fn main() {}
diff --git a/src/test/ui/track-diagnostics/track4.stderr b/src/test/ui/track-diagnostics/track4.stderr
new file mode 100644
index 000000000..c4668444c
--- /dev/null
+++ b/src/test/ui/track-diagnostics/track4.stderr
@@ -0,0 +1,14 @@
+error: missing `struct` for struct definition
+ --> $DIR/track4.rs:LL:CC
+ |
+LL | pub onion {
+ | ^
+-Ztrack-diagnostics: created at compiler/rustc_parse/src/parser/diagnostics.rs:LL:CC
+ |
+help: add `struct` here to parse `onion` as a public struct
+ |
+LL | pub struct onion {
+ | ++++++
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/track-diagnostics/track5.rs b/src/test/ui/track-diagnostics/track5.rs
new file mode 100644
index 000000000..c41d9424e
--- /dev/null
+++ b/src/test/ui/track-diagnostics/track5.rs
@@ -0,0 +1,8 @@
+// compile-flags: -Z track-diagnostics
+// error-pattern: created at
+
+// Normalize the emitted location so this doesn't need
+// updating everytime someone adds or removes a line.
+// normalize-stderr-test ".rs:\d+:\d+" -> ".rs:LL:CC"
+
+}
diff --git a/src/test/ui/track-diagnostics/track5.stderr b/src/test/ui/track-diagnostics/track5.stderr
new file mode 100644
index 000000000..aa54f92b6
--- /dev/null
+++ b/src/test/ui/track-diagnostics/track5.stderr
@@ -0,0 +1,9 @@
+error: unexpected closing delimiter: `}`
+ --> $DIR/track5.rs:LL:CC
+ |
+LL | }
+ | ^ unexpected closing delimiter
+-Ztrack-diagnostics: created at compiler/rustc_parse/src/lexer/tokentrees.rs:LL:CC
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/track-diagnostics/track6.rs b/src/test/ui/track-diagnostics/track6.rs
new file mode 100644
index 000000000..307e31018
--- /dev/null
+++ b/src/test/ui/track-diagnostics/track6.rs
@@ -0,0 +1,14 @@
+// compile-flags: -Z track-diagnostics
+// error-pattern: created at
+
+
+
+pub trait Foo {
+ fn bar();
+}
+
+impl <T> Foo for T {
+ default fn bar() {}
+}
+
+fn main() {}
diff --git a/src/test/ui/track-diagnostics/track6.stderr b/src/test/ui/track-diagnostics/track6.stderr
new file mode 100644
index 000000000..1c7537633
--- /dev/null
+++ b/src/test/ui/track-diagnostics/track6.stderr
@@ -0,0 +1,13 @@
+error[E0658]: specialization is unstable
+ --> $DIR/track6.rs:11:5
+ |
+LL | default fn bar() {}
+ | ^^^^^^^^^^^^^^^^^^^
+-Ztrack-diagnostics: created at $COMPILER_DIR/rustc_session/src/parse.rs:93:5
+ |
+ = 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
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.