review comments
This commit is contained in:
parent
12ddf77811
commit
147c9bf4d5
1 changed files with 4 additions and 11 deletions
|
@ -2129,11 +2129,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
let infcx = tcx.infer_ctxt().build();
|
let infcx = tcx.infer_ctxt().build();
|
||||||
// We create a fresh `ty::ParamEnv` instead of the one for `self.item_def_id()`
|
// We create a fresh `ty::ParamEnv` instead of the one for `self.item_def_id()`
|
||||||
// to avoid a cycle error in `src/test/ui/resolve/issue-102946.rs`.
|
// to avoid a cycle error in `src/test/ui/resolve/issue-102946.rs`.
|
||||||
let param_env = ty::ParamEnv::new(
|
let param_env = ty::ParamEnv::empty();
|
||||||
ty::List::empty(),
|
|
||||||
traits::Reveal::All,
|
|
||||||
hir::Constness::NotConst,
|
|
||||||
);
|
|
||||||
let traits: Vec<_> = self
|
let traits: Vec<_> = self
|
||||||
.tcx()
|
.tcx()
|
||||||
.all_traits()
|
.all_traits()
|
||||||
|
@ -2141,17 +2137,16 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
// Consider only traits with the associated type
|
// Consider only traits with the associated type
|
||||||
tcx.associated_items(*trait_def_id)
|
tcx.associated_items(*trait_def_id)
|
||||||
.in_definition_order()
|
.in_definition_order()
|
||||||
.find(|i| {
|
.any(|i| {
|
||||||
i.kind.namespace() == Namespace::TypeNS
|
i.kind.namespace() == Namespace::TypeNS
|
||||||
&& i.ident(tcx).normalize_to_macros_2_0() == assoc_ident
|
&& i.ident(tcx).normalize_to_macros_2_0() == assoc_ident
|
||||||
&& matches!(i.kind, ty::AssocKind::Type)
|
&& matches!(i.kind, ty::AssocKind::Type)
|
||||||
})
|
})
|
||||||
.is_some()
|
|
||||||
// Consider only accessible traits
|
// Consider only accessible traits
|
||||||
&& tcx.visibility(*trait_def_id)
|
&& tcx.visibility(*trait_def_id)
|
||||||
.is_accessible_from(self.item_def_id(), tcx)
|
.is_accessible_from(self.item_def_id(), tcx)
|
||||||
&& tcx.all_impls(*trait_def_id)
|
&& tcx.all_impls(*trait_def_id)
|
||||||
.filter(|impl_def_id| {
|
.any(|impl_def_id| {
|
||||||
let trait_ref = tcx.impl_trait_ref(impl_def_id);
|
let trait_ref = tcx.impl_trait_ref(impl_def_id);
|
||||||
trait_ref.map_or(false, |impl_| {
|
trait_ref.map_or(false, |impl_| {
|
||||||
infcx
|
infcx
|
||||||
|
@ -2164,8 +2159,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
})
|
})
|
||||||
&& tcx.impl_polarity(impl_def_id) != ty::ImplPolarity::Negative
|
&& tcx.impl_polarity(impl_def_id) != ty::ImplPolarity::Negative
|
||||||
})
|
})
|
||||||
.next()
|
|
||||||
.is_some()
|
|
||||||
})
|
})
|
||||||
.map(|trait_def_id| tcx.def_path_str(trait_def_id))
|
.map(|trait_def_id| tcx.def_path_str(trait_def_id))
|
||||||
.collect();
|
.collect();
|
||||||
|
@ -2305,7 +2298,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
.filter_map(|impl_def_id| tcx.impl_trait_ref(impl_def_id))
|
.filter_map(|impl_def_id| tcx.impl_trait_ref(impl_def_id))
|
||||||
.map(|impl_| impl_.self_ty())
|
.map(|impl_| impl_.self_ty())
|
||||||
// We don't care about blanket impls.
|
// We don't care about blanket impls.
|
||||||
.filter(|self_ty| !self_ty.has_non_region_infer())
|
.filter(|self_ty| !self_ty.has_non_region_param())
|
||||||
.map(|self_ty| tcx.erase_regions(self_ty).to_string())
|
.map(|self_ty| tcx.erase_regions(self_ty).to_string())
|
||||||
.collect()
|
.collect()
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue