summaryrefslogtreecommitdiffstats
path: root/tests/ui/mir
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:25:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:25:56 +0000
commit018c4950b9406055dec02ef0fb52f132e2bb1e2c (patch)
treea835ebdf2088ef88fa681f8fad45f09922c1ae9a /tests/ui/mir
parentAdding debian version 1.75.0+dfsg1-5. (diff)
downloadrustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.tar.xz
rustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.zip
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/mir')
-rw-r--r--tests/ui/mir/build-async-error-body-correctly.stderr2
-rw-r--r--tests/ui/mir/field-projection-mutating-context.stderr6
-rw-r--r--tests/ui/mir/field-projection-mutating-context2.stderr2
-rw-r--r--tests/ui/mir/issue-102389.stderr2
-rw-r--r--tests/ui/mir/issue-106062.stderr2
-rw-r--r--tests/ui/mir/issue-75053.stderr2
-rw-r--r--tests/ui/mir/issue-92893.stderr2
-rw-r--r--tests/ui/mir/mir_raw_fat_ptr.rs2
-rw-r--r--tests/ui/mir/ssa_call_ret.rs30
-rw-r--r--tests/ui/mir/validate/critical-edge.rs31
-rw-r--r--tests/ui/mir/validate/noncleanup-cleanup.rs21
-rw-r--r--tests/ui/mir/validate/noncleanup-resume.rs17
-rw-r--r--tests/ui/mir/validate/noncleanup-terminate.rs17
13 files changed, 127 insertions, 9 deletions
diff --git a/tests/ui/mir/build-async-error-body-correctly.stderr b/tests/ui/mir/build-async-error-body-correctly.stderr
index 3d18c249a..4b9cdc4f9 100644
--- a/tests/ui/mir/build-async-error-body-correctly.stderr
+++ b/tests/ui/mir/build-async-error-body-correctly.stderr
@@ -12,6 +12,6 @@ LL + _ => todo!(),
LL ~ };
|
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/mir/field-projection-mutating-context.stderr b/tests/ui/mir/field-projection-mutating-context.stderr
index 9b18b3427..c7289c0f0 100644
--- a/tests/ui/mir/field-projection-mutating-context.stderr
+++ b/tests/ui/mir/field-projection-mutating-context.stderr
@@ -4,9 +4,9 @@ error[E0308]: mismatched types
LL | let Foo(ref mut y): Foo<fn(&'static str)> = x;
| ^^^^^^^^^ one type is more general than the other
|
- = note: expected fn pointer `for<'a> fn(&'a str)`
- found fn pointer `fn(&str)`
+ = note: expected fn pointer `for<'a> fn(&'a _)`
+ found fn pointer `fn(&_)`
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/mir/field-projection-mutating-context2.stderr b/tests/ui/mir/field-projection-mutating-context2.stderr
index a7b66fe10..167400170 100644
--- a/tests/ui/mir/field-projection-mutating-context2.stderr
+++ b/tests/ui/mir/field-projection-mutating-context2.stderr
@@ -6,5 +6,5 @@ LL | fn foo<'a>(mut x: Foo<fn(&'a str)>, string: &'a str) {
LL | let Foo(ref mut y): Foo<fn(&'static str)> = x;
| ^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/mir/issue-102389.stderr b/tests/ui/mir/issue-102389.stderr
index 925dc258a..1f04d119b 100644
--- a/tests/ui/mir/issue-102389.stderr
+++ b/tests/ui/mir/issue-102389.stderr
@@ -4,6 +4,6 @@ error[E0507]: cannot move out of `*inbounds` which is behind a shared reference
LL | array[*inbounds as usize]
| ^^^^^^^^^ move occurs because `*inbounds` has type `Enum`, which does not implement the `Copy` trait
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0507`.
diff --git a/tests/ui/mir/issue-106062.stderr b/tests/ui/mir/issue-106062.stderr
index 2f6524d03..30635148d 100644
--- a/tests/ui/mir/issue-106062.stderr
+++ b/tests/ui/mir/issue-106062.stderr
@@ -11,6 +11,6 @@ LL | async fn connection_handler(handler: impl Sized) -> Result<core::result
LL | async fn connection_handler(handler: impl Sized) -> Result<std::result::Result, std::io::Error> {
| ~~~~~~~~~~~~~~~~~~~
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0573`.
diff --git a/tests/ui/mir/issue-75053.stderr b/tests/ui/mir/issue-75053.stderr
index 64e59e6c4..bd37f0c92 100644
--- a/tests/ui/mir/issue-75053.stderr
+++ b/tests/ui/mir/issue-75053.stderr
@@ -4,5 +4,5 @@ error: fatal error triggered by #[rustc_error]
LL | fn main() {
| ^^^^^^^^^
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/mir/issue-92893.stderr b/tests/ui/mir/issue-92893.stderr
index 6c1a9dc03..3bf056d15 100644
--- a/tests/ui/mir/issue-92893.stderr
+++ b/tests/ui/mir/issue-92893.stderr
@@ -6,5 +6,5 @@ LL | struct Bug<A = [(); (let a = (), 1).1]> {
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/mir/mir_raw_fat_ptr.rs b/tests/ui/mir/mir_raw_fat_ptr.rs
index 6aceefbe7..f4a9afd23 100644
--- a/tests/ui/mir/mir_raw_fat_ptr.rs
+++ b/tests/ui/mir/mir_raw_fat_ptr.rs
@@ -1,7 +1,9 @@
// run-pass
// check raw fat pointer ops in mir
// FIXME: please improve this when we get monomorphization support
+
#![feature(raw_ref_op)]
+#![allow(ambiguous_wide_pointer_comparisons)]
use std::mem;
diff --git a/tests/ui/mir/ssa_call_ret.rs b/tests/ui/mir/ssa_call_ret.rs
new file mode 100644
index 000000000..6132a6691
--- /dev/null
+++ b/tests/ui/mir/ssa_call_ret.rs
@@ -0,0 +1,30 @@
+// Regression test for issue #117331, where variable `a` was misidentified as
+// being in SSA form (the definition occurs on the return edge only).
+//
+// edition:2021
+// compile-flags: --crate-type=lib
+// build-pass
+// needs-unwind
+#![feature(custom_mir, core_intrinsics)]
+use core::intrinsics::mir::*;
+
+#[custom_mir(dialect = "runtime", phase = "optimized")]
+pub fn f() -> u32 {
+ mir!(
+ let a: u32;
+ {
+ Call(a = g(), bb1, UnwindCleanup(bb2))
+ }
+ bb1 = {
+ RET = a;
+ Return()
+ }
+ bb2 (cleanup) = {
+ RET = a;
+ UnwindResume()
+ }
+ )
+}
+
+#[inline(never)]
+pub fn g() -> u32 { 0 }
diff --git a/tests/ui/mir/validate/critical-edge.rs b/tests/ui/mir/validate/critical-edge.rs
new file mode 100644
index 000000000..9ef655cd1
--- /dev/null
+++ b/tests/ui/mir/validate/critical-edge.rs
@@ -0,0 +1,31 @@
+// Optimized MIR shouldn't have critical call edges
+//
+// build-fail
+// edition: 2021
+// compile-flags: --crate-type=lib
+// failure-status: 101
+// dont-check-compiler-stderr
+// error-pattern: encountered critical edge in `Call` terminator
+#![feature(custom_mir, core_intrinsics)]
+use core::intrinsics::mir::*;
+
+#[custom_mir(dialect = "runtime", phase = "optimized")]
+#[inline(always)]
+pub fn f(a: u32) -> u32 {
+ mir!(
+ {
+ match a {
+ 0 => bb1,
+ _ => bb2,
+ }
+ }
+ bb1 = {
+ Call(RET = f(1), bb2, UnwindTerminate(ReasonAbi))
+ }
+
+ bb2 = {
+ RET = 2;
+ Return()
+ }
+ )
+}
diff --git a/tests/ui/mir/validate/noncleanup-cleanup.rs b/tests/ui/mir/validate/noncleanup-cleanup.rs
new file mode 100644
index 000000000..0a1c4528a
--- /dev/null
+++ b/tests/ui/mir/validate/noncleanup-cleanup.rs
@@ -0,0 +1,21 @@
+// Check that validation rejects cleanup edge to a non-cleanup block.
+//
+// failure-status: 101
+// dont-check-compiler-stderr
+// error-pattern: cleanuppad mismatch
+#![feature(custom_mir, core_intrinsics)]
+extern crate core;
+use core::intrinsics::mir::*;
+
+#[custom_mir(dialect = "built")]
+pub fn main() {
+ mir!(
+ {
+ Call(RET = main(), block, UnwindCleanup(block))
+ }
+ block = {
+ Return()
+ }
+ )
+
+}
diff --git a/tests/ui/mir/validate/noncleanup-resume.rs b/tests/ui/mir/validate/noncleanup-resume.rs
new file mode 100644
index 000000000..e80d09bc9
--- /dev/null
+++ b/tests/ui/mir/validate/noncleanup-resume.rs
@@ -0,0 +1,17 @@
+// Check that validation rejects resume terminator in a non-cleanup block.
+//
+// failure-status: 101
+// dont-check-compiler-stderr
+// error-pattern: resume on non-cleanup block
+#![feature(custom_mir, core_intrinsics)]
+extern crate core;
+use core::intrinsics::mir::*;
+
+#[custom_mir(dialect = "built")]
+pub fn main() {
+ mir!(
+ {
+ UnwindResume()
+ }
+ )
+}
diff --git a/tests/ui/mir/validate/noncleanup-terminate.rs b/tests/ui/mir/validate/noncleanup-terminate.rs
new file mode 100644
index 000000000..2a7466837
--- /dev/null
+++ b/tests/ui/mir/validate/noncleanup-terminate.rs
@@ -0,0 +1,17 @@
+// Check that validation rejects terminate terminator in a non-cleanup block.
+//
+// failure-status: 101
+// dont-check-compiler-stderr
+// error-pattern: terminate on non-cleanup block
+#![feature(custom_mir, core_intrinsics)]
+extern crate core;
+use core::intrinsics::mir::*;
+
+#[custom_mir(dialect = "built")]
+pub fn main() {
+ mir!(
+ {
+ UnwindTerminate(ReasonAbi)
+ }
+ )
+}