summaryrefslogtreecommitdiffstats
path: root/tests/ui/mir
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:36 +0000
commite02c5b5930c2c9ba3e5423fe12e2ef0155017297 (patch)
treefd60ebbbb5299e16e5fca8c773ddb74f764760db /tests/ui/mir
parentAdding debian version 1.73.0+dfsg1-1. (diff)
downloadrustc-e02c5b5930c2c9ba3e5423fe12e2ef0155017297.tar.xz
rustc-e02c5b5930c2c9ba3e5423fe12e2ef0155017297.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/mir')
-rw-r--r--tests/ui/mir/issue-92893.rs4
-rw-r--r--tests/ui/mir/issue-92893.stderr18
-rw-r--r--tests/ui/mir/mir-inlining/always-encode-mirs.rs12
-rw-r--r--tests/ui/mir/mir-inlining/auxiliary/internal.rs7
4 files changed, 21 insertions, 20 deletions
diff --git a/tests/ui/mir/issue-92893.rs b/tests/ui/mir/issue-92893.rs
index 635050f37..6127d267e 100644
--- a/tests/ui/mir/issue-92893.rs
+++ b/tests/ui/mir/issue-92893.rs
@@ -1,7 +1,5 @@
struct Bug<A = [(); (let a = (), 1).1]> {
- //~^ `let` expressions are not supported here
- //~| `let` expressions in this position are unstable [E0658]
- //~| expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
a: A
}
diff --git a/tests/ui/mir/issue-92893.stderr b/tests/ui/mir/issue-92893.stderr
index 4a0fcce31..6c1a9dc03 100644
--- a/tests/ui/mir/issue-92893.stderr
+++ b/tests/ui/mir/issue-92893.stderr
@@ -3,24 +3,8 @@ error: expected expression, found `let` statement
|
LL | struct Bug<A = [(); (let a = (), 1).1]> {
| ^^^
-
-error: `let` expressions are not supported here
- --> $DIR/issue-92893.rs:1:22
- |
-LL | struct Bug<A = [(); (let a = (), 1).1]> {
- | ^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/issue-92893.rs:1:22
- |
-LL | struct Bug<A = [(); (let a = (), 1).1]> {
- | ^^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error: aborting due to 3 previous errors
+error: aborting due to previous error
-For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/mir/mir-inlining/always-encode-mirs.rs b/tests/ui/mir/mir-inlining/always-encode-mirs.rs
new file mode 100644
index 000000000..f3731996c
--- /dev/null
+++ b/tests/ui/mir/mir-inlining/always-encode-mirs.rs
@@ -0,0 +1,12 @@
+// Regression test for MIR inlining with -Zalways-encode-mir enabled in the auxiliary crate.
+// Previously we inlined function not eligible for inlining which lead to linking error:
+// undefined reference to `internal::S'
+//
+// aux-build:internal.rs
+// build-pass
+// compile-flags: -O
+extern crate internal;
+
+fn main() {
+ println!("{}", internal::f());
+}
diff --git a/tests/ui/mir/mir-inlining/auxiliary/internal.rs b/tests/ui/mir/mir-inlining/auxiliary/internal.rs
new file mode 100644
index 000000000..fa0f9c2da
--- /dev/null
+++ b/tests/ui/mir/mir-inlining/auxiliary/internal.rs
@@ -0,0 +1,7 @@
+// compile-flags: -Zalways-encode-mir
+
+static S: usize = 42;
+
+pub fn f() -> &'static usize {
+ &S
+}