diff options
Diffstat (limited to 'tests/coverage/inline-dead.rs')
-rw-r--r-- | tests/coverage/inline-dead.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/coverage/inline-dead.rs b/tests/coverage/inline-dead.rs new file mode 100644 index 000000000..854fa0629 --- /dev/null +++ b/tests/coverage/inline-dead.rs @@ -0,0 +1,27 @@ +// Regression test for issue #98833. +// compile-flags: -Zinline-mir -Cdebug-assertions=off + +fn main() { + println!("{}", live::<false>()); + + let f = |x: bool| { + debug_assert!( + x + ); + }; + f(false); +} + +#[inline] +fn live<const B: bool>() -> u32 { + if B { + dead() + } else { + 0 + } +} + +#[inline] +fn dead() -> u32 { + 42 +} |