Add more normalization and tests

This commit is contained in:
mejrs 2022-10-24 23:19:48 +02:00
parent 854b3166a0
commit 447d57f036
13 changed files with 101 additions and 10 deletions

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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
}

View file

@ -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

View file

@ -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");
}

View file

@ -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`.

View file

@ -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 };
}

View file

@ -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`.

View file

@ -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() {}

View file

@ -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

View file

@ -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;

View file

@ -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