diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index 79cb7fb0b76..6462672c010 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -230,6 +230,11 @@ fn should_inline(&self, let codegen_fn_attrs = tcx.codegen_fn_attrs(callsite.callee); + if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::TRACK_CALLER) { + debug!("`#[track_caller]` present - not inlining"); + return false; + } + let hinted = match codegen_fn_attrs.inline { // Just treat inline(always) as a hint for now, // there are cases that prevent inlining that we