about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-09-13 18:37:43 +0200
committerGitHub <noreply@github.com>2023-09-13 18:37:43 +0200
commit48d89a87595230599579e1cf6d2c5b3f085dd034 (patch)
treedeb1fc3f4630ef019bbc8adbca78f0e46ff489f2 /tests
parent27c6099c7915b4d57839e1f7af93b95fd1effd8d (diff)
parent7c53e87d556f7ce878a446c9db058877ceb69d10 (diff)
downloadrust-48d89a87595230599579e1cf6d2c5b3f085dd034.tar.gz
rust-48d89a87595230599579e1cf6d2c5b3f085dd034.zip
Rollup merge of #115815 - bvanjoi:fix-115809, r=oli-obk
fix: return early when has tainted in mir pass

Fixes https://github.com/rust-lang/rust/issues/115809

As in #115643, `run_pass` is skipped if the body has tainted errors.

r? `@oli-obk`
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/unsized/issue-115809.rs13
-rw-r--r--tests/ui/unsized/issue-115809.stderr19
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/ui/unsized/issue-115809.rs b/tests/ui/unsized/issue-115809.rs
new file mode 100644
index 00000000000..ff25365ea50
--- /dev/null
+++ b/tests/ui/unsized/issue-115809.rs
@@ -0,0 +1,13 @@
+// compile-flags: --emit=link -Zmir-opt-level=2 -Zpolymorphize=on
+
+fn foo<T>() {
+    let a: [i32; 0] = [];
+    match [a[..]] {
+        //~^ ERROR cannot move a value of type `[i32]
+        //~| ERROR cannot move out of type `[i32]`, a non-copy slice
+        [[x]] => {}
+        _ => (),
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/unsized/issue-115809.stderr b/tests/ui/unsized/issue-115809.stderr
new file mode 100644
index 00000000000..a92554b79b9
--- /dev/null
+++ b/tests/ui/unsized/issue-115809.stderr
@@ -0,0 +1,19 @@
+error[E0161]: cannot move a value of type `[i32]`
+  --> $DIR/issue-115809.rs:5:12
+   |
+LL |     match [a[..]] {
+   |            ^^^^^ the size of `[i32]` cannot be statically determined
+
+error[E0508]: cannot move out of type `[i32]`, a non-copy slice
+  --> $DIR/issue-115809.rs:5:12
+   |
+LL |     match [a[..]] {
+   |            ^^^^^
+   |            |
+   |            cannot move out of here
+   |            move occurs because value has type `[i32]`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0161, E0508.
+For more information about an error, try `rustc --explain E0161`.