diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-03-06 18:19:05 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-03-11 22:41:01 +0000 |
| commit | facf1e017d2372364aafc6289278117281bb0d1f (patch) | |
| tree | f8f546e0da871f63ad9ee6b3307da4577b04575e | |
| parent | 1ca103a16885564a999dce3916d97007766f2ff1 (diff) | |
Use ensure for thir_abstract_const.
| -rw-r--r-- | compiler/rustc_mir_build/src/build/mod.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/compiler/rustc_mir_build/src/build/mod.rs b/compiler/rustc_mir_build/src/build/mod.rs index b3f9d82829f..d51b031d366 100644 --- a/compiler/rustc_mir_build/src/build/mod.rs +++ b/compiler/rustc_mir_build/src/build/mod.rs @@ -48,17 +48,14 @@ pub(crate) fn mir_built( /// Construct the MIR for a given `DefId`. fn mir_build(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> Body<'_> { // Ensure unsafeck and abstract const building is ran before we steal the THIR. - // We can't use `ensure()` for `thir_abstract_const` as it doesn't compute the query - // if inputs are green. This can cause ICEs when calling `thir_abstract_const` after - // THIR has been stolen if we haven't computed this query yet. match def { ty::WithOptConstParam { did, const_param_did: Some(const_param_did) } => { tcx.ensure().thir_check_unsafety_for_const_arg((did, const_param_did)); - drop(tcx.thir_abstract_const_of_const_arg((did, const_param_did))); + tcx.ensure().thir_abstract_const_of_const_arg((did, const_param_did)); } ty::WithOptConstParam { did, const_param_did: None } => { tcx.ensure().thir_check_unsafety(did); - drop(tcx.thir_abstract_const(did)); + tcx.ensure().thir_abstract_const(did); } } |
