diff --git a/src/test/mir-opt/copy_propagation.rs b/src/test/mir-opt/copy_propagation.rs index a45e7f21023..69486f46137 100644 --- a/src/test/mir-opt/copy_propagation.rs +++ b/src/test/mir-opt/copy_propagation.rs @@ -13,7 +13,10 @@ fn test(x: u32) -> u32 { y } -fn main() { } +fn main() { + // Make sure the function actually gets instantiated. + test(0); +} // END RUST SOURCE // START rustc.node4.CopyPropagation.before.mir diff --git a/src/test/mir-opt/deaggregator_test.rs b/src/test/mir-opt/deaggregator_test.rs index 9fe17a277a7..f4db00dab59 100644 --- a/src/test/mir-opt/deaggregator_test.rs +++ b/src/test/mir-opt/deaggregator_test.rs @@ -18,7 +18,10 @@ fn bar(a: usize) -> Baz { Baz { x: a, y: 0.0, z: false } } -fn main() {} +fn main() { + // Make sure the function actually gets instantiated. + bar(0); +} // END RUST SOURCE // START rustc.node13.Deaggregator.before.mir diff --git a/src/test/mir-opt/deaggregator_test_enum_2.rs b/src/test/mir-opt/deaggregator_test_enum_2.rs index 2780f11b9e6..8e7207af0c6 100644 --- a/src/test/mir-opt/deaggregator_test_enum_2.rs +++ b/src/test/mir-opt/deaggregator_test_enum_2.rs @@ -23,7 +23,10 @@ fn test1(x: bool, y: i32) -> Foo { } } -fn main() {} +fn main() { + // Make sure the function actually gets instantiated. + test1(false, 0); +} // END RUST SOURCE // START rustc.node12.Deaggregator.before.mir diff --git a/src/test/mir-opt/deaggregator_test_multiple.rs b/src/test/mir-opt/deaggregator_test_multiple.rs index ede3b2e6e29..bc06ab67eaa 100644 --- a/src/test/mir-opt/deaggregator_test_multiple.rs +++ b/src/test/mir-opt/deaggregator_test_multiple.rs @@ -19,7 +19,10 @@ fn test(x: i32) -> [Foo; 2] { [Foo::A(x), Foo::A(x)] } -fn main() { } +fn main() { + // Make sure the function actually gets instantiated. + test(0); +} // END RUST SOURCE // START rustc.node10.Deaggregator.before.mir diff --git a/src/test/mir-opt/issue-41110.rs b/src/test/mir-opt/issue-41110.rs index 384201b7c12..de789e07d9f 100644 --- a/src/test/mir-opt/issue-41110.rs +++ b/src/test/mir-opt/issue-41110.rs @@ -14,7 +14,10 @@ fn main() { let x = S.other(S.id()); } -pub fn test() { +// no_mangle and extern C to make sure this gets instantiated even in an +// executable. +#[no_mangle] +pub extern "C" fn test() { let u = S; let mut v = S; drop(v);