summaryrefslogtreecommitdiffstats
path: root/tests/ui/unpretty
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui/unpretty
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/unpretty')
-rw-r--r--tests/ui/unpretty/avoid-crash.rs4
-rw-r--r--tests/ui/unpretty/avoid-crash.stderr4
-rw-r--r--tests/ui/unpretty/bad-literal.rs8
-rw-r--r--tests/ui/unpretty/bad-literal.stderr10
-rw-r--r--tests/ui/unpretty/bad-literal.stdout11
-rw-r--r--tests/ui/unpretty/pretty-let-else.rs10
-rw-r--r--tests/ui/unpretty/pretty-let-else.stdout18
7 files changed, 65 insertions, 0 deletions
diff --git a/tests/ui/unpretty/avoid-crash.rs b/tests/ui/unpretty/avoid-crash.rs
new file mode 100644
index 000000000..fd84b70d9
--- /dev/null
+++ b/tests/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/tests/ui/unpretty/avoid-crash.stderr b/tests/ui/unpretty/avoid-crash.stderr
new file mode 100644
index 000000000..11cd3866f
--- /dev/null
+++ b/tests/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/tests/ui/unpretty/bad-literal.rs b/tests/ui/unpretty/bad-literal.rs
new file mode 100644
index 000000000..6dcc0da30
--- /dev/null
+++ b/tests/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/tests/ui/unpretty/bad-literal.stderr b/tests/ui/unpretty/bad-literal.stderr
new file mode 100644
index 000000000..f3fcb4a4e
--- /dev/null
+++ b/tests/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/tests/ui/unpretty/bad-literal.stdout b/tests/ui/unpretty/bad-literal.stdout
new file mode 100644
index 000000000..8df933270
--- /dev/null
+++ b/tests/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/tests/ui/unpretty/pretty-let-else.rs b/tests/ui/unpretty/pretty-let-else.rs
new file mode 100644
index 000000000..b5ae52969
--- /dev/null
+++ b/tests/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/tests/ui/unpretty/pretty-let-else.stdout b/tests/ui/unpretty/pretty-let-else.stdout
new file mode 100644
index 000000000..35ad1cd1b
--- /dev/null
+++ b/tests/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() { }