summaryrefslogtreecommitdiff
path: root/tests/ui/unpretty
diff options
context:
space:
mode:
authorjyn <jyn.nelson@redjack.com>2023-04-02 19:30:32 -0400
committerjyn <jyn.nelson@redjack.com>2023-04-02 19:42:30 -0400
commit01b75e20f2f92e3086bc004cd2f4430bf41ccdc0 (patch)
tree757e8c283825445ecae6a3ccc0c32500bb7aca14 /tests/ui/unpretty
parenteb3e9c1f45981b47160543cfd882ca00e69bbfab (diff)
downloadrust-01b75e20f2f92e3086bc004cd2f4430bf41ccdc0.tar.gz
Move some UI tests into subdirectories
to avoid going over the existing limit now that the ui-fulldeps tests have been moved to ui.
Diffstat (limited to 'tests/ui/unpretty')
-rw-r--r--tests/ui/unpretty/mir-unpretty.rs5
-rw-r--r--tests/ui/unpretty/mir-unpretty.stderr11
-rw-r--r--tests/ui/unpretty/unpretty-expr-fn-arg.rs13
-rw-r--r--tests/ui/unpretty/unpretty-expr-fn-arg.stdout17
4 files changed, 46 insertions, 0 deletions
diff --git a/tests/ui/unpretty/mir-unpretty.rs b/tests/ui/unpretty/mir-unpretty.rs
new file mode 100644
index 00000000000..30620c69fea
--- /dev/null
+++ b/tests/ui/unpretty/mir-unpretty.rs
@@ -0,0 +1,5 @@
+// compile-flags: -Z unpretty=mir
+
+fn main() {
+ let x: () = 0; //~ ERROR: mismatched types
+}
diff --git a/tests/ui/unpretty/mir-unpretty.stderr b/tests/ui/unpretty/mir-unpretty.stderr
new file mode 100644
index 00000000000..3808f8583b8
--- /dev/null
+++ b/tests/ui/unpretty/mir-unpretty.stderr
@@ -0,0 +1,11 @@
+error[E0308]: mismatched types
+ --> $DIR/mir-unpretty.rs:4:17
+ |
+LL | let x: () = 0;
+ | -- ^ expected `()`, found integer
+ | |
+ | expected due to this
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/unpretty/unpretty-expr-fn-arg.rs b/tests/ui/unpretty/unpretty-expr-fn-arg.rs
new file mode 100644
index 00000000000..6e1132a3372
--- /dev/null
+++ b/tests/ui/unpretty/unpretty-expr-fn-arg.rs
@@ -0,0 +1,13 @@
+// Regression test for the ICE described in #82328. The pretty-printer for
+// `-Zunpretty=hir,typed` would previously retrieve type-checking results
+// when entering a body, which means that type information was not available
+// for expressions occurring in function signatures, as in the `foo` example
+// below, leading to an ICE.
+
+// check-pass
+// compile-flags: -Zunpretty=hir,typed
+#![allow(dead_code)]
+
+fn main() {}
+
+fn foo(-128..=127: i8) {}
diff --git a/tests/ui/unpretty/unpretty-expr-fn-arg.stdout b/tests/ui/unpretty/unpretty-expr-fn-arg.stdout
new file mode 100644
index 00000000000..b745b988631
--- /dev/null
+++ b/tests/ui/unpretty/unpretty-expr-fn-arg.stdout
@@ -0,0 +1,17 @@
+// Regression test for the ICE described in #82328. The pretty-printer for
+// `-Zunpretty=hir,typed` would previously retrieve type-checking results
+// when entering a body, which means that type information was not available
+// for expressions occurring in function signatures, as in the `foo` example
+// below, leading to an ICE.
+
+// check-pass
+// compile-flags: -Zunpretty=hir,typed
+#![allow(dead_code)]
+#[prelude_import]
+use ::std::prelude::rust_2015::*;
+#[macro_use]
+extern crate std;
+
+fn main() ({ } as ())
+
+fn foo((-(128 as i8) as i8)...(127 as i8): i8) ({ } as ())