diff options
| author | bors <bors@rust-lang.org> | 2022-03-30 22:09:56 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-03-30 22:09:56 +0000 |
| commit | a40c595695bff3bfb373a8a3355ae4bd4ea64608 (patch) | |
| tree | 8b2f8edf18e6557da3fdd81eec8726397af7a9eb /compiler/rustc_mir_transform/src/inline.rs | |
| parent | c5cf08d37b85f953b132951e868df5b924250fdc (diff) | |
| parent | 21a554caf680b74ee6270d3a61b0336b643c5456 (diff) | |
Auto merge of #95436 - cjgillot:static-mut, r=oli-obk
Remember mutability in `DefKind::Static`. This allows to compute the `BodyOwnerKind` from `DefKind` only, and removes a direct dependency of some MIR queries onto HIR. As a side effect, it also simplifies metadata, since we don't need 4 flavours of `EntryKind::*Static` any more.
Diffstat (limited to 'compiler/rustc_mir_transform/src/inline.rs')
| -rw-r--r-- | compiler/rustc_mir_transform/src/inline.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs index 23e5f0b4f30..b6bb56990ed 100644 --- a/compiler/rustc_mir_transform/src/inline.rs +++ b/compiler/rustc_mir_transform/src/inline.rs @@ -59,11 +59,10 @@ impl<'tcx> MirPass<'tcx> for Inline { } fn inline<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) -> bool { - let def_id = body.source.def_id(); - let hir_id = tcx.hir().local_def_id_to_hir_id(def_id.expect_local()); + let def_id = body.source.def_id().expect_local(); // Only do inlining into fn bodies. - if !tcx.hir().body_owner_kind(hir_id).is_fn_or_closure() { + if !tcx.hir().body_owner_kind(def_id).is_fn_or_closure() { return false; } if body.source.promoted.is_some() { @@ -77,9 +76,10 @@ fn inline<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) -> bool { } let param_env = tcx.param_env_reveal_all_normalized(def_id); + let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); let param_env = rustc_trait_selection::traits::normalize_param_env_or_error( tcx, - def_id, + def_id.to_def_id(), param_env, ObligationCause::misc(body.span, hir_id), ); |
