diff options
| author | The Miri Conjob Bot <miri@cron.bot> | 2023-08-31 05:40:49 +0000 |
|---|---|---|
| committer | The Miri Conjob Bot <miri@cron.bot> | 2023-08-31 05:40:49 +0000 |
| commit | 31d9ac14f52c88fbec16a12787e23a7f5ba671cf (patch) | |
| tree | 6a886a36309aecfd5d3712a24e51bc28f8197917 /compiler/rustc_mir_transform/src/inline.rs | |
| parent | 4b915b8a86df64e6758b6cc329d83d5fe635f21d (diff) | |
| parent | 8cbd2c847b682a3ce460a79fa7576ee2eb461a00 (diff) | |
| download | rust-31d9ac14f52c88fbec16a12787e23a7f5ba671cf.tar.gz rust-31d9ac14f52c88fbec16a12787e23a7f5ba671cf.zip | |
Merge from rustc
Diffstat (limited to 'compiler/rustc_mir_transform/src/inline.rs')
| -rw-r--r-- | compiler/rustc_mir_transform/src/inline.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs index 9551c7a2a8d..7d4c4a823a8 100644 --- a/compiler/rustc_mir_transform/src/inline.rs +++ b/compiler/rustc_mir_transform/src/inline.rs @@ -388,14 +388,11 @@ impl<'tcx> Inliner<'tcx> { return Err("never inline hint"); } - // Only inline local functions if they would be eligible for cross-crate - // inlining. This is to ensure that the final crate doesn't have MIR that - // reference unexported symbols - if callsite.callee.def_id().is_local() { - let is_generic = callsite.callee.args.non_erasable_generics().next().is_some(); - if !is_generic && !callee_attrs.requests_inline() { - return Err("not exported"); - } + // Reachability pass defines which functions are eligible for inlining. Generally inlining + // other functions is incorrect because they could reference symbols that aren't exported. + let is_generic = callsite.callee.args.non_erasable_generics().next().is_some(); + if !is_generic && !callee_attrs.requests_inline() { + return Err("not exported"); } if callsite.fn_sig.c_variadic() { |
