1
Fork 0

Rollup merge of #120872 - petrochenkov:opthirpar, r=cjgillot

hir: Refactor getters for HIR parents

See individual commits.

I ended up removing on of the FIXMEs from https://github.com/rust-lang/rust/pull/120206 instead of addressing it.
This commit is contained in:
Matthias Krüger 2024-02-11 23:19:08 +01:00 committed by GitHub
commit 4c154a1a48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
79 changed files with 263 additions and 342 deletions

View file

@ -131,11 +131,10 @@ fn is_parent_const_stable_trait(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
let local_def_id = def_id.expect_local();
let hir_id = tcx.local_def_id_to_hir_id(local_def_id);
let Some(parent) = tcx.hir().opt_parent_id(hir_id) else { return false };
if !tcx.is_const_trait_impl_raw(parent.owner.def_id.to_def_id()) {
let parent_owner_id = tcx.parent_hir_id(hir_id).owner;
if !tcx.is_const_trait_impl_raw(parent_owner_id.to_def_id()) {
return false;
}
tcx.lookup_const_stability(parent.owner).is_some_and(|stab| stab.is_const_stable())
tcx.lookup_const_stability(parent_owner_id).is_some_and(|stab| stab.is_const_stable())
}