diff options
| author | mejrs <> | 2022-10-24 23:19:48 +0200 |
|---|---|---|
| committer | mejrs <> | 2022-10-24 23:19:48 +0200 |
| commit | 447d57f03669a551d395f8e9a77fac8316480e92 (patch) | |
| tree | 49bdf31be298ce1b71906a95c2277bec3791e47a | |
| parent | 854b3166a05916f01b6a7cb9c09fc7c8d26697ad (diff) | |
| download | rust-447d57f03669a551d395f8e9a77fac8316480e92.tar.gz rust-447d57f03669a551d395f8e9a77fac8316480e92.zip | |
Add more normalization and tests
| -rw-r--r-- | src/test/rustdoc-ui/track-diagnostics.rs | 4 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/track-diagnostics.stderr | 4 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/z-help.stdout | 2 | ||||
| -rw-r--r-- | src/test/ui/track-diagnostics/track.rs | 5 | ||||
| -rw-r--r-- | src/test/ui/track-diagnostics/track.stderr | 10 | ||||
| -rw-r--r-- | src/test/ui/track-diagnostics/track2.rs | 10 | ||||
| -rw-r--r-- | src/test/ui/track-diagnostics/track2.stderr | 13 | ||||
| -rw-r--r-- | src/test/ui/track-diagnostics/track3.rs | 10 | ||||
| -rw-r--r-- | src/test/ui/track-diagnostics/track3.stderr | 18 | ||||
| -rw-r--r-- | src/test/ui/track-diagnostics/track4.rs | 13 | ||||
| -rw-r--r-- | src/test/ui/track-diagnostics/track4.stderr | 14 | ||||
| -rw-r--r-- | src/tools/clippy/tests/ui/track-diagnostics.rs | 4 | ||||
| -rw-r--r-- | src/tools/clippy/tests/ui/track-diagnostics.stderr | 4 |
13 files changed, 101 insertions, 10 deletions
diff --git a/src/test/rustdoc-ui/track-diagnostics.rs b/src/test/rustdoc-ui/track-diagnostics.rs index fc5343a982e..3da80adbf44 100644 --- a/src/test/rustdoc-ui/track-diagnostics.rs +++ b/src/test/rustdoc-ui/track-diagnostics.rs @@ -1,6 +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:$$LINE::$$COL" + struct A; struct B; const S: A = B; diff --git a/src/test/rustdoc-ui/track-diagnostics.stderr b/src/test/rustdoc-ui/track-diagnostics.stderr index 76453cfe220..5a0982ff731 100644 --- a/src/test/rustdoc-ui/track-diagnostics.stderr +++ b/src/test/rustdoc-ui/track-diagnostics.stderr @@ -1,9 +1,9 @@ error[E0308]: mismatched types - --> $DIR/track-diagnostics.rs:6:14 + --> $DIR/track-diagnostics.rs:$LINE::$COL | LL | const S: A = B; | ^ expected struct `A`, found struct `B` --Ztrack-diagnostics: created at compiler/rustc_infer/src/infer/error_reporting/mod.rs:2275:31 +-Ztrack-diagnostics: created at compiler/rustc_infer/src/infer/error_reporting/mod.rs:$LINE::$COL error: aborting due to previous error diff --git a/src/test/rustdoc-ui/z-help.stdout b/src/test/rustdoc-ui/z-help.stdout index 07c8793c08b..d9d19651456 100644 --- a/src/test/rustdoc-ui/z-help.stdout +++ b/src/test/rustdoc-ui/z-help.stdout @@ -170,7 +170,7 @@ -Z time-passes=val -- measure time of each rustc pass (default: no) -Z tls-model=val -- choose the TLS model to use (`rustc --print tls-models` for details) -Z trace-macros=val -- for every macro invocation, print its name and arguments (default: no) - -Z track-diagnostics=val -- Tracks where in rustc a diagnostic was emitted + -Z track-diagnostics=val -- tracks where in rustc a diagnostic was emitted -Z translate-additional-ftl=val -- additional fluent translation to preferentially use (for testing translation) -Z translate-directionality-markers=val -- emit directionality isolation markers in translated diagnostics -Z translate-lang=val -- language identifier for diagnostic output diff --git a/src/test/ui/track-diagnostics/track.rs b/src/test/ui/track-diagnostics/track.rs index 3427c593e85..23c0c8c4ed8 100644 --- a/src/test/ui/track-diagnostics/track.rs +++ b/src/test/ui/track-diagnostics/track.rs @@ -1,6 +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:$$LINE::$$COL" +// 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 index 83ff935dbab..ed5c70b5a06 100644 --- a/src/test/ui/track-diagnostics/track.stderr +++ b/src/test/ui/track-diagnostics/track.stderr @@ -1,16 +1,16 @@ error[E0425]: cannot find value `rust` in this scope - --> $DIR/track.rs:5:11 + --> $DIR/track.rs:$LINE::$COL | LL | break rust | ^^^^ not found in this scope --Ztrack-diagnostics: created at compiler/rustc_resolve/src/late/diagnostics.rs:289:28 +-Ztrack-diagnostics: created at compiler/rustc_resolve/src/late/diagnostics.rs:$LINE::$COL error[E0268]: `break` outside of a loop - --> $DIR/track.rs:5:5 + --> $DIR/track.rs:$LINE::$COL | LL | break rust | ^^^^^^^^^^ cannot `break` outside of a loop --Ztrack-diagnostics: created at compiler/rustc_passes/src/errors.rs:957:10 +-Ztrack-diagnostics: created at compiler/rustc_passes/src/errors.rs:$LINE::$COL error: internal compiler error: It looks like you're trying to break rust; would you like some ICE? @@ -18,7 +18,7 @@ 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 1.66.0-dev running on x86_64-pc-windows-msvc +note: rustc $VERSION running on $TARGET error: aborting due to 3 previous errors diff --git a/src/test/ui/track-diagnostics/track2.rs b/src/test/ui/track-diagnostics/track2.rs new file mode 100644 index 00000000000..45afd081566 --- /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:$$LINE::$$COL" + +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 00000000000..28d17f1e141 --- /dev/null +++ b/src/test/ui/track-diagnostics/track2.stderr @@ -0,0 +1,13 @@ +error[E0382]: use of moved value + --> $DIR/track2.rs:$LINE::$COL + | +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:$LINE::$COL + +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 00000000000..e9316a42189 --- /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:$$LINE::$$COL" + +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 00000000000..005380df430 --- /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:$LINE::$COL + | +LL | let _unimported = Blah { field: u8 }; + | ^^^^ not found in this scope +-Ztrack-diagnostics: created at compiler/rustc_resolve/src/late/diagnostics.rs:$LINE::$COL + +error[E0423]: expected value, found builtin type `u8` + --> $DIR/track3.rs:$LINE::$COL + | +LL | let _unimported = Blah { field: u8 }; + | ^^ not a value +-Ztrack-diagnostics: created at compiler/rustc_resolve/src/late/diagnostics.rs:$LINE::$COL + +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 00000000000..065cc604604 --- /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:$$LINE::$$COL" + +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 00000000000..e0cedcee0d3 --- /dev/null +++ b/src/test/ui/track-diagnostics/track4.stderr @@ -0,0 +1,14 @@ +error: missing `struct` for struct definition + --> $DIR/track4.rs:$LINE::$COL + | +LL | pub onion { + | ^ +-Ztrack-diagnostics: created at compiler/rustc_parse/src/parser/diagnostics.rs:$LINE::$COL + | +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/tools/clippy/tests/ui/track-diagnostics.rs b/src/tools/clippy/tests/ui/track-diagnostics.rs index 8c96f46d57a..550ccd7b3d3 100644 --- a/src/tools/clippy/tests/ui/track-diagnostics.rs +++ b/src/tools/clippy/tests/ui/track-diagnostics.rs @@ -1,6 +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:$$LINE::$$COL" + struct A; struct B; const S: A = B; diff --git a/src/tools/clippy/tests/ui/track-diagnostics.stderr b/src/tools/clippy/tests/ui/track-diagnostics.stderr index 76453cfe220..5a0982ff731 100644 --- a/src/tools/clippy/tests/ui/track-diagnostics.stderr +++ b/src/tools/clippy/tests/ui/track-diagnostics.stderr @@ -1,9 +1,9 @@ error[E0308]: mismatched types - --> $DIR/track-diagnostics.rs:6:14 + --> $DIR/track-diagnostics.rs:$LINE::$COL | LL | const S: A = B; | ^ expected struct `A`, found struct `B` --Ztrack-diagnostics: created at compiler/rustc_infer/src/infer/error_reporting/mod.rs:2275:31 +-Ztrack-diagnostics: created at compiler/rustc_infer/src/infer/error_reporting/mod.rs:$LINE::$COL error: aborting due to previous error |
