Remove unnecessary recursive call to parent unsafeck

All bodies are unsafe checked anyway. Current MIR unsafeck also just
returns for closures.
This commit is contained in:
Gary Guo 2022-12-01 23:51:03 +00:00
parent adf1717219
commit 5c58a1b003

View File

@ -627,9 +627,6 @@ pub fn check_unsafety<'tcx>(tcx: TyCtxt<'tcx>, def: ty::WithOptConstParam<LocalD
// Closures and inline consts are handled by their owner, if it has a body
if tcx.is_typeck_child(def.did.to_def_id()) {
let hir = tcx.hir();
let owner = hir.enclosing_body_owner(hir.local_def_id_to_hir_id(def.did));
tcx.ensure().thir_check_unsafety(owner);
return;
}