File tree 1 file changed +6
-3
lines changed
compiler/rustc_mir_build/src/build
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<'_
44
44
let body_owner_kind = tcx. hir ( ) . body_owner_kind ( id) ;
45
45
let typeck_results = tcx. typeck_opt_const_arg ( def) ;
46
46
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.
48
51
match def {
49
52
ty:: WithOptConstParam { did, const_param_did : Some ( const_param_did) } => {
50
53
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) ) ) ;
52
55
}
53
56
ty:: WithOptConstParam { did, const_param_did : None } => {
54
57
tcx. ensure ( ) . thir_check_unsafety ( did) ;
55
- tcx. ensure ( ) . thir_abstract_const ( did) ;
58
+ drop ( tcx. thir_abstract_const ( did) ) ;
56
59
}
57
60
}
58
61
You can’t perform that action at this time.
0 commit comments