Skip to content

Commit 73ad5ad

Browse files
committed
Cross-crate inline functions that only call another function.
1 parent 8927649 commit 73ad5ad

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

compiler/rustc_mir_transform/src/cross_crate_inline.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ fn cross_crate_inlinable(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
9696
let mut checker =
9797
CostChecker { tcx, callee_body: mir, calls: 0, statements: 0, landing_pads: 0, resumes: 0 };
9898
checker.visit_body(mir);
99-
checker.calls == 0
100-
&& checker.resumes == 0
101-
&& checker.landing_pads == 0
99+
checker.calls <= 1
100+
&& checker.resumes <= checker.calls
101+
&& checker.landing_pads <= checker.calls
102102
&& checker.statements <= threshold
103103
}
104104

tests/mir-opt/c_unwind_terminate.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ impl Drop for Noise {
77
}
88
}
99

10+
#[inline(never)]
1011
fn panic() {
1112
panic!();
1213
}

0 commit comments

Comments
 (0)