File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
compiler/rustc_mir_build/src/build Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -44,15 +44,18 @@ fn mir_build(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> Body<'_
4444 let body_owner_kind = tcx. hir ( ) . body_owner_kind ( id) ;
4545 let typeck_results = tcx. typeck_opt_const_arg ( def) ;
4646
47- // Ensure unsafeck is ran before we steal the THIR.
47+ // Ensure unsafeck and abstract const building is ran before we steal the THIR.
48+ // We can't use `ensure()` for `thir_abstract_const` as it doesn't compute the query
49+ // if inputs are green. This can cause ICEs when calling `thir_abstract_const` after
50+ // THIR has been stolen if we haven't computed this query yet.
4851 match def {
4952 ty:: WithOptConstParam { did, const_param_did : Some ( const_param_did) } => {
5053 tcx. ensure ( ) . thir_check_unsafety_for_const_arg ( ( did, const_param_did) ) ;
51- tcx. ensure ( ) . thir_abstract_const_of_const_arg ( ( did, const_param_did) ) ;
54+ drop ( tcx. thir_abstract_const_of_const_arg ( ( did, const_param_did) ) ) ;
5255 }
5356 ty:: WithOptConstParam { did, const_param_did : None } => {
5457 tcx. ensure ( ) . thir_check_unsafety ( did) ;
55- tcx. ensure ( ) . thir_abstract_const ( did) ;
58+ drop ( tcx. thir_abstract_const ( did) ) ;
5659 }
5760 }
5861
You can’t perform that action at this time.
0 commit comments