Ensure that THIR unsafety check is done before stealing it. Fixes #111520.
This commit is contained in:
parent
d06ca0ffaf
commit
4170ca4be9
1 changed files with 2 additions and 1 deletions
|
@ -56,7 +56,8 @@ pub(crate) fn closure_saved_names_of_captured_variables<'tcx>(
|
|||
/// Construct the MIR for a given `DefId`.
|
||||
fn mir_build(tcx: TyCtxt<'_>, def: LocalDefId) -> Body<'_> {
|
||||
// Ensure unsafeck and abstract const building is ran before we steal the THIR.
|
||||
tcx.ensure_with_value().thir_check_unsafety(def);
|
||||
tcx.ensure_with_value()
|
||||
.thir_check_unsafety(tcx.typeck_root_def_id(def.to_def_id()).expect_local());
|
||||
tcx.ensure_with_value().thir_abstract_const(def);
|
||||
if let Err(e) = tcx.check_match(def) {
|
||||
return construct_error(tcx, def, e);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue