about summary refs log tree commit diff
path: root/tests/mir-opt/inline/forced_inherent_dead_code.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mir-opt/inline/forced_inherent_dead_code.rs')
-rw-r--r--tests/mir-opt/inline/forced_inherent_dead_code.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/mir-opt/inline/forced_inherent_dead_code.rs b/tests/mir-opt/inline/forced_inherent_dead_code.rs
new file mode 100644
index 00000000000..057a4cac528
--- /dev/null
+++ b/tests/mir-opt/inline/forced_inherent_dead_code.rs
@@ -0,0 +1,21 @@
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+//@ compile-flags: -Copt-level=0 -Clink-dead-code
+#![feature(rustc_attrs)]
+
+struct Foo {}
+
+impl Foo {
+    #[rustc_force_inline]
+    pub fn callee_forced() {}
+}
+
+// EMIT_MIR forced_inherent_dead_code.caller.ForceInline.diff
+pub fn caller() {
+    Foo::callee_forced();
+    // CHECK-LABEL: fn caller(
+    // CHECK: (inlined Foo::callee_forced)
+}
+
+fn main() {
+    caller();
+}