Skip to content

Commit facf1e0

Browse files
committed
Use ensure for thir_abstract_const.
1 parent 1ca103a commit facf1e0

File tree

1 file changed

+2
-5
lines changed
  • compiler/rustc_mir_build/src/build

1 file changed

+2
-5
lines changed

compiler/rustc_mir_build/src/build/mod.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,14 @@ pub(crate) fn mir_built(
4848
/// Construct the MIR for a given `DefId`.
4949
fn mir_build(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> Body<'_> {
5050
// Ensure unsafeck and abstract const building is ran before we steal the THIR.
51-
// We can't use `ensure()` for `thir_abstract_const` as it doesn't compute the query
52-
// if inputs are green. This can cause ICEs when calling `thir_abstract_const` after
53-
// THIR has been stolen if we haven't computed this query yet.
5451
match def {
5552
ty::WithOptConstParam { did, const_param_did: Some(const_param_did) } => {
5653
tcx.ensure().thir_check_unsafety_for_const_arg((did, const_param_did));
57-
drop(tcx.thir_abstract_const_of_const_arg((did, const_param_did)));
54+
tcx.ensure().thir_abstract_const_of_const_arg((did, const_param_did));
5855
}
5956
ty::WithOptConstParam { did, const_param_did: None } => {
6057
tcx.ensure().thir_check_unsafety(did);
61-
drop(tcx.thir_abstract_const(did));
58+
tcx.ensure().thir_abstract_const(did);
6259
}
6360
}
6461

0 commit comments

Comments
 (0)