diff --git a/compiler/rustc_mir_transform/src/cross_crate_inline.rs b/compiler/rustc_mir_transform/src/cross_crate_inline.rs index 7fc9fb9cca2d7..e82c7c1ff879a 100644 --- a/compiler/rustc_mir_transform/src/cross_crate_inline.rs +++ b/compiler/rustc_mir_transform/src/cross_crate_inline.rs @@ -96,9 +96,9 @@ fn cross_crate_inlinable(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool { let mut checker = CostChecker { tcx, callee_body: mir, calls: 0, statements: 0, landing_pads: 0, resumes: 0 }; checker.visit_body(mir); - checker.calls == 0 - && checker.resumes == 0 - && checker.landing_pads == 0 + checker.calls <= 1 + && checker.resumes <= checker.calls + && checker.landing_pads <= checker.calls && checker.statements <= threshold } diff --git a/tests/mir-opt/c_unwind_terminate.rs b/tests/mir-opt/c_unwind_terminate.rs index 64524e74d28e5..12eeef7f9f93f 100644 --- a/tests/mir-opt/c_unwind_terminate.rs +++ b/tests/mir-opt/c_unwind_terminate.rs @@ -7,6 +7,7 @@ impl Drop for Noise { } } +#[inline(never)] fn panic() { panic!(); }