change impl_trait_ref query to return EarlyBinder; remove bound_impl_trait_ref query; add EarlyBinder to impl_trait_ref in metadata

This commit is contained in:
Kyle Matsuda
2023-01-10 14:57:22 -07:00
parent be130b57d4
commit f29a334c90
59 changed files with 108 additions and 127 deletions

View File

@@ -2187,12 +2187,8 @@ impl<'tcx> TyCtxt<'tcx> {
) -> Option<ImplOverlapKind> {
// If either trait impl references an error, they're allowed to overlap,
// as one of them essentially doesn't exist.
if self
.bound_impl_trait_ref(def_id1)
.map_or(false, |tr| tr.skip_binder().references_error())
|| self
.bound_impl_trait_ref(def_id2)
.map_or(false, |tr| tr.skip_binder().references_error())
if self.impl_trait_ref(def_id1).map_or(false, |tr| tr.skip_binder().references_error())
|| self.impl_trait_ref(def_id2).map_or(false, |tr| tr.skip_binder().references_error())
{
return Some(ImplOverlapKind::Permitted { marker: false });
}
@@ -2221,7 +2217,7 @@ impl<'tcx> TyCtxt<'tcx> {
let is_marker_overlap = {
let is_marker_impl = |def_id: DefId| -> bool {
let trait_ref = self.bound_impl_trait_ref(def_id);
let trait_ref = self.impl_trait_ref(def_id);
trait_ref.map_or(false, |tr| self.trait_def(tr.skip_binder().def_id).is_marker)
};
is_marker_impl(def_id1) && is_marker_impl(def_id2)
@@ -2368,7 +2364,7 @@ impl<'tcx> TyCtxt<'tcx> {
/// Given the `DefId` of an impl, returns the `DefId` of the trait it implements.
/// If it implements no trait, returns `None`.
pub fn trait_id_of_impl(self, def_id: DefId) -> Option<DefId> {
self.bound_impl_trait_ref(def_id).map(|tr| tr.skip_binder().def_id)
self.impl_trait_ref(def_id).map(|tr| tr.skip_binder().def_id)
}
/// If the given `DefId` describes an item belonging to a trait,