summaryrefslogtreecommitdiffstats
path: root/tests/ui/mir/mir-inlining
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/mir/mir-inlining')
-rw-r--r--tests/ui/mir/mir-inlining/always-encode-mirs.rs12
-rw-r--r--tests/ui/mir/mir-inlining/auxiliary/internal.rs7
2 files changed, 19 insertions, 0 deletions
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
+}