about summary refs log tree commit diff
path: root/tests/ui/track-diagnostics
diff options
context:
space:
mode:
authorAlbert Larsan <74931857+albertlarsan68@users.noreply.github.com>2023-01-05 09:13:28 +0100
committerAlbert Larsan <74931857+albertlarsan68@users.noreply.github.com>2023-01-11 09:32:08 +0000
commitcf2dff2b1e3fa55fa5415d524200070d0d7aacfe (patch)
tree40a88d9a46aaf3e8870676eb2538378b75a263eb /tests/ui/track-diagnostics
parentca855e6e42787ecd062d81d53336fe6788ef51a9 (diff)
downloadrust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.tar.gz
rust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.zip
Move /src/test to /tests
Diffstat (limited to 'tests/ui/track-diagnostics')
-rw-r--r--tests/ui/track-diagnostics/track.rs11
-rw-r--r--tests/ui/track-diagnostics/track.stderr26
-rw-r--r--tests/ui/track-diagnostics/track2.rs10
-rw-r--r--tests/ui/track-diagnostics/track2.stderr18
-rw-r--r--tests/ui/track-diagnostics/track3.rs10
-rw-r--r--tests/ui/track-diagnostics/track3.stderr18
-rw-r--r--tests/ui/track-diagnostics/track4.rs13
-rw-r--r--tests/ui/track-diagnostics/track4.stderr14
-rw-r--r--tests/ui/track-diagnostics/track5.rs8
-rw-r--r--tests/ui/track-diagnostics/track5.stderr9
-rw-r--r--tests/ui/track-diagnostics/track6.rs14
-rw-r--r--tests/ui/track-diagnostics/track6.stderr13
12 files changed, 164 insertions, 0 deletions
diff --git a/tests/ui/track-diagnostics/track.rs b/tests/ui/track-diagnostics/track.rs
new file mode 100644
index 00000000000..61b9137eadd
--- /dev/null
+++ b/tests/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/tests/ui/track-diagnostics/track.stderr b/tests/ui/track-diagnostics/track.stderr
new file mode 100644
index 00000000000..8256c1f5f0f
--- /dev/null
+++ b/tests/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/tests/ui/track-diagnostics/track2.rs b/tests/ui/track-diagnostics/track2.rs
new file mode 100644
index 00000000000..dc105c61d72
--- /dev/null
+++ b/tests/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/tests/ui/track-diagnostics/track2.stderr b/tests/ui/track-diagnostics/track2.stderr
new file mode 100644
index 00000000000..fe13e5ef3f5
--- /dev/null
+++ b/tests/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/tests/ui/track-diagnostics/track3.rs b/tests/ui/track-diagnostics/track3.rs
new file mode 100644
index 00000000000..0699239503a
--- /dev/null
+++ b/tests/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/tests/ui/track-diagnostics/track3.stderr b/tests/ui/track-diagnostics/track3.stderr
new file mode 100644
index 00000000000..dc468d7e8ee
--- /dev/null
+++ b/tests/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/tests/ui/track-diagnostics/track4.rs b/tests/ui/track-diagnostics/track4.rs
new file mode 100644
index 00000000000..35eec799bba
--- /dev/null
+++ b/tests/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/tests/ui/track-diagnostics/track4.stderr b/tests/ui/track-diagnostics/track4.stderr
new file mode 100644
index 00000000000..c4668444c4b
--- /dev/null
+++ b/tests/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/tests/ui/track-diagnostics/track5.rs b/tests/ui/track-diagnostics/track5.rs
new file mode 100644
index 00000000000..c41d9424e85
--- /dev/null
+++ b/tests/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/tests/ui/track-diagnostics/track5.stderr b/tests/ui/track-diagnostics/track5.stderr
new file mode 100644
index 00000000000..aa54f92b6c0
--- /dev/null
+++ b/tests/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/tests/ui/track-diagnostics/track6.rs b/tests/ui/track-diagnostics/track6.rs
new file mode 100644
index 00000000000..307e3101849
--- /dev/null
+++ b/tests/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/tests/ui/track-diagnostics/track6.stderr b/tests/ui/track-diagnostics/track6.stderr
new file mode 100644
index 00000000000..1c7537633ff
--- /dev/null
+++ b/tests/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`.