1
Fork 0

make tcx.impl_subject return EarlyBinder, remove bound_impl_subject, rename usages of bound_impl_subject to impl_subject

This commit is contained in:
Kyle Matsuda 2023-04-13 15:23:54 -06:00
parent dcc51f1ef5
commit e2f5a5a71f
4 changed files with 10 additions and 12 deletions

View file

@ -7,7 +7,7 @@ pub mod nested_filter;
pub mod place;
use crate::ty::query::Providers;
use crate::ty::{ImplSubject, TyCtxt};
use crate::ty::{EarlyBinder, ImplSubject, TyCtxt};
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_data_structures::sync::{par_for_each_in, Send, Sync};
use rustc_hir::def_id::{DefId, LocalDefId};
@ -104,11 +104,13 @@ impl<'tcx> TyCtxt<'tcx> {
self.parent_module_from_def_id(id.owner.def_id)
}
pub fn impl_subject(self, def_id: DefId) -> ImplSubject<'tcx> {
self.impl_trait_ref(def_id)
.map(|t| t.subst_identity())
.map(ImplSubject::Trait)
.unwrap_or_else(|| ImplSubject::Inherent(self.type_of(def_id).subst_identity()))
pub fn impl_subject(self, def_id: DefId) -> EarlyBinder<ImplSubject<'tcx>> {
EarlyBinder(
self.impl_trait_ref(def_id)
.map(|t| t.subst_identity())
.map(ImplSubject::Trait)
.unwrap_or_else(|| ImplSubject::Inherent(self.type_of(def_id).subst_identity())),
)
}
}