1
Fork 0

Rollup merge of #99311 - kckeiks:clean-up-body-owner-methods, r=cjgillot

change maybe_body_owned_by to take local def id

Issue https://github.com/rust-lang/rust/issues/96341
r? `@cjgillot`
This commit is contained in:
Dylan DPC 2022-07-30 20:39:46 +05:30 committed by GitHub
commit c668820365
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 58 additions and 51 deletions

View file

@ -626,7 +626,7 @@ pub fn check_unsafety<'tcx>(tcx: TyCtxt<'tcx>, def: ty::WithOptConstParam<LocalD
if tcx.is_closure(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(hir.local_def_id(owner));
tcx.ensure().thir_check_unsafety(owner);
return;
}

View file

@ -21,7 +21,7 @@ pub(crate) fn thir_body<'tcx>(
owner_def: ty::WithOptConstParam<LocalDefId>,
) -> Result<(&'tcx Steal<Thir<'tcx>>, ExprId), ErrorGuaranteed> {
let hir = tcx.hir();
let body = hir.body(hir.body_owned_by(hir.local_def_id_to_hir_id(owner_def.did)));
let body = hir.body(hir.body_owned_by(owner_def.did));
let mut cx = Cx::new(tcx, owner_def);
if let Some(reported) = cx.typeck_results.tainted_by_errors {
return Err(reported);

View file

@ -26,7 +26,7 @@ use rustc_span::{BytePos, Span};
pub(crate) fn check_match(tcx: TyCtxt<'_>, def_id: DefId) {
let body_id = match def_id.as_local() {
None => return,
Some(id) => tcx.hir().body_owned_by(tcx.hir().local_def_id_to_hir_id(id)),
Some(def_id) => tcx.hir().body_owned_by(def_id),
};
let pattern_arena = TypedArena::default();