diff options
| author | Ben Kimock <kimockb@gmail.com> | 2023-10-06 20:29:42 -0400 |
|---|---|---|
| committer | Ben Kimock <kimockb@gmail.com> | 2023-10-17 19:53:51 -0400 |
| commit | 33b0e4be060c8a3f5cc86b6a3e89d8e980a9a51b (patch) | |
| tree | 79040aac88d1e13a620fd8d730822a727a6cf323 /compiler/rustc_middle/src/ty/instance.rs | |
| parent | 09df6108c84fdec400043d99d9ee232336fd5a9f (diff) | |
| download | rust-33b0e4be060c8a3f5cc86b6a3e89d8e980a9a51b.tar.gz rust-33b0e4be060c8a3f5cc86b6a3e89d8e980a9a51b.zip | |
Automatically enable cross-crate inlining for small functions
Diffstat (limited to 'compiler/rustc_middle/src/ty/instance.rs')
| -rw-r--r-- | compiler/rustc_middle/src/ty/instance.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/rustc_middle/src/ty/instance.rs b/compiler/rustc_middle/src/ty/instance.rs index 0a425be52ff..0b308d5dec1 100644 --- a/compiler/rustc_middle/src/ty/instance.rs +++ b/compiler/rustc_middle/src/ty/instance.rs @@ -245,16 +245,15 @@ impl<'tcx> InstanceDef<'tcx> { // drops of `Option::None` before LTO. We also respect the intent of // `#[inline]` on `Drop::drop` implementations. return ty.ty_adt_def().map_or(true, |adt_def| { - adt_def.destructor(tcx).map_or_else( - || adt_def.is_enum(), - |dtor| tcx.codegen_fn_attrs(dtor.did).requests_inline(), - ) + adt_def + .destructor(tcx) + .map_or_else(|| adt_def.is_enum(), |dtor| tcx.cross_crate_inlinable(dtor.did)) }); } if let ty::InstanceDef::ThreadLocalShim(..) = *self { return false; } - tcx.codegen_fn_attrs(self.def_id()).requests_inline() + tcx.cross_crate_inlinable(self.def_id()) } pub fn requires_caller_location(&self, tcx: TyCtxt<'_>) -> bool { |
