diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:03:36 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:03:36 +0000 |
commit | 17d40c6057c88f4c432b0d7bac88e1b84cb7e67f (patch) | |
tree | 3f66c4a5918660bb8a758ab6cda5ff8ee4f6cdcd /src/test/ui/unpretty | |
parent | Adding upstream version 1.64.0+dfsg1. (diff) | |
download | rustc-17d40c6057c88f4c432b0d7bac88e1b84cb7e67f.tar.xz rustc-17d40c6057c88f4c432b0d7bac88e1b84cb7e67f.zip |
Adding upstream version 1.65.0+dfsg1.upstream/1.65.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/unpretty')
-rw-r--r-- | src/test/ui/unpretty/avoid-crash.rs | 4 | ||||
-rw-r--r-- | src/test/ui/unpretty/avoid-crash.stderr | 4 | ||||
-rw-r--r-- | src/test/ui/unpretty/bad-literal.rs | 8 | ||||
-rw-r--r-- | src/test/ui/unpretty/bad-literal.stderr | 10 | ||||
-rw-r--r-- | src/test/ui/unpretty/bad-literal.stdout | 11 | ||||
-rw-r--r-- | src/test/ui/unpretty/pretty-let-else.rs | 10 | ||||
-rw-r--r-- | src/test/ui/unpretty/pretty-let-else.stdout | 18 |
7 files changed, 65 insertions, 0 deletions
diff --git a/src/test/ui/unpretty/avoid-crash.rs b/src/test/ui/unpretty/avoid-crash.rs new file mode 100644 index 000000000..fd84b70d9 --- /dev/null +++ b/src/test/ui/unpretty/avoid-crash.rs @@ -0,0 +1,4 @@ +// normalize-stderr-test "error `.*`" -> "$$ERROR_MESSAGE" +// compile-flags: -o/tmp/ -Zunpretty=ast-tree + +fn main() {} diff --git a/src/test/ui/unpretty/avoid-crash.stderr b/src/test/ui/unpretty/avoid-crash.stderr new file mode 100644 index 000000000..11cd3866f --- /dev/null +++ b/src/test/ui/unpretty/avoid-crash.stderr @@ -0,0 +1,4 @@ +error: pretty-print failed to write `/tmp/` due to $ERROR_MESSAGE + +error: aborting due to previous error + diff --git a/src/test/ui/unpretty/bad-literal.rs b/src/test/ui/unpretty/bad-literal.rs new file mode 100644 index 000000000..6dcc0da30 --- /dev/null +++ b/src/test/ui/unpretty/bad-literal.rs @@ -0,0 +1,8 @@ +// compile-flags: -Zunpretty=hir +// check-fail + +// In #100948 this caused an ICE with -Zunpretty=hir. +fn main() { + 1u; + //~^ ERROR invalid suffix `u` for number literal +} diff --git a/src/test/ui/unpretty/bad-literal.stderr b/src/test/ui/unpretty/bad-literal.stderr new file mode 100644 index 000000000..f3fcb4a4e --- /dev/null +++ b/src/test/ui/unpretty/bad-literal.stderr @@ -0,0 +1,10 @@ +error: invalid suffix `u` for number literal + --> $DIR/bad-literal.rs:6:5 + | +LL | 1u; + | ^^ invalid suffix `u` + | + = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) + +error: aborting due to previous error + diff --git a/src/test/ui/unpretty/bad-literal.stdout b/src/test/ui/unpretty/bad-literal.stdout new file mode 100644 index 000000000..8df933270 --- /dev/null +++ b/src/test/ui/unpretty/bad-literal.stdout @@ -0,0 +1,11 @@ +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; +// compile-flags: -Zunpretty=hir +// check-fail + +// In #100948 this caused an ICE with -Zunpretty=hir. +fn main() { + <bad-literal>; + } diff --git a/src/test/ui/unpretty/pretty-let-else.rs b/src/test/ui/unpretty/pretty-let-else.rs new file mode 100644 index 000000000..b5ae52969 --- /dev/null +++ b/src/test/ui/unpretty/pretty-let-else.rs @@ -0,0 +1,10 @@ +// compile-flags: -Zunpretty=hir +// check-pass + + + +fn foo(x: Option<u32>) { + let Some(_) = x else { panic!() }; +} + +fn main() {} diff --git a/src/test/ui/unpretty/pretty-let-else.stdout b/src/test/ui/unpretty/pretty-let-else.stdout new file mode 100644 index 000000000..35ad1cd1b --- /dev/null +++ b/src/test/ui/unpretty/pretty-let-else.stdout @@ -0,0 +1,18 @@ +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; +// compile-flags: -Zunpretty=hir +// check-pass + + + +fn foo(x: + Option<u32>) { + let Some(_) = x else + { + + { ::std::rt::begin_panic("explicit panic") } + }; + } +fn main() { } |