Some rebinds and dummys
This commit is contained in:
parent
a5029ac0ab
commit
4955d755d3
9 changed files with 29 additions and 20 deletions
|
@ -82,9 +82,10 @@ impl<'tcx> AutoTraitFinder<'tcx> {
|
|||
) -> AutoTraitResult<A> {
|
||||
let tcx = self.tcx;
|
||||
|
||||
debug_assert!(!ty.has_escaping_bound_vars());
|
||||
let trait_ref = ty::TraitRef { def_id: trait_did, substs: tcx.mk_substs_trait(ty, &[]) };
|
||||
|
||||
let trait_pred = ty::Binder::bind(trait_ref);
|
||||
let trait_pred = ty::Binder::dummy(trait_ref);
|
||||
|
||||
let bail_out = tcx.infer_ctxt().enter(|infcx| {
|
||||
let mut selcx = SelectionContext::with_negative(&infcx, true);
|
||||
|
@ -280,7 +281,7 @@ impl AutoTraitFinder<'tcx> {
|
|||
|
||||
let mut already_visited = FxHashSet::default();
|
||||
let mut predicates = VecDeque::new();
|
||||
predicates.push_back(ty::Binder::bind(ty::TraitPredicate {
|
||||
predicates.push_back(ty::Binder::dummy(ty::TraitPredicate {
|
||||
trait_ref: ty::TraitRef {
|
||||
def_id: trait_did,
|
||||
substs: infcx.tcx.mk_substs_trait(ty, &[]),
|
||||
|
|
|
@ -757,7 +757,7 @@ fn contains_illegal_self_type_reference<'tcx, T: TypeFoldable<'tcx>>(
|
|||
struct IllegalSelfTypeVisitor<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
trait_def_id: DefId,
|
||||
supertraits: Option<Vec<ty::PolyTraitRef<'tcx>>>,
|
||||
supertraits: Option<Vec<DefId>>,
|
||||
}
|
||||
|
||||
impl<'tcx> TypeVisitor<'tcx> for IllegalSelfTypeVisitor<'tcx> {
|
||||
|
@ -778,8 +778,10 @@ fn contains_illegal_self_type_reference<'tcx, T: TypeFoldable<'tcx>>(
|
|||
// Compute supertraits of current trait lazily.
|
||||
if self.supertraits.is_none() {
|
||||
let trait_ref =
|
||||
ty::Binder::bind(ty::TraitRef::identity(self.tcx, self.trait_def_id));
|
||||
self.supertraits = Some(traits::supertraits(self.tcx, trait_ref).collect());
|
||||
ty::Binder::dummy(ty::TraitRef::identity(self.tcx, self.trait_def_id));
|
||||
self.supertraits = Some(
|
||||
traits::supertraits(self.tcx, trait_ref).map(|t| t.def_id()).collect(),
|
||||
);
|
||||
}
|
||||
|
||||
// Determine whether the trait reference `Foo as
|
||||
|
@ -790,9 +792,11 @@ fn contains_illegal_self_type_reference<'tcx, T: TypeFoldable<'tcx>>(
|
|||
// direct equality here because all of these types
|
||||
// are part of the formal parameter listing, and
|
||||
// hence there should be no inference variables.
|
||||
let projection_trait_ref = ty::Binder::bind(data.trait_ref(self.tcx));
|
||||
let is_supertrait_of_current_trait =
|
||||
self.supertraits.as_ref().unwrap().contains(&projection_trait_ref);
|
||||
let is_supertrait_of_current_trait = self
|
||||
.supertraits
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.contains(&data.trait_ref(self.tcx).def_id);
|
||||
|
||||
if is_supertrait_of_current_trait {
|
||||
ControlFlow::CONTINUE // do not walk contained types, do not report error, do collect $200
|
||||
|
|
|
@ -748,7 +748,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
cause,
|
||||
obligation.recursion_depth + 1,
|
||||
obligation.param_env,
|
||||
ty::Binder::bind(outlives).to_predicate(tcx),
|
||||
obligation.predicate.rebind(outlives).to_predicate(tcx),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue