somewhat related cleanup

This commit is contained in:
Bastian Kauschke 2020-06-17 23:20:17 +02:00
parent 653f56af53
commit 1fda8c207e
2 changed files with 4 additions and 11 deletions

View file

@ -1302,7 +1302,7 @@ impl<'tcx> Predicate<'tcx> {
// from the substitution and the value being substituted into, and // from the substitution and the value being substituted into, and
// this trick achieves that). // this trick achieves that).
let substs = &trait_ref.skip_binder().substs; let substs = trait_ref.skip_binder().substs;
let kind = self.kind(); let kind = self.kind();
let new = match kind { let new = match kind {
&PredicateKind::Trait(ref binder, constness) => { &PredicateKind::Trait(ref binder, constness) => {
@ -1555,13 +1555,6 @@ impl<'tcx> ToPredicate<'tcx> for ConstnessAnd<PolyTraitRef<'tcx>> {
} }
} }
impl<'tcx> ToPredicate<'tcx> for ConstnessAnd<&PolyTraitRef<'tcx>> {
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
ty::PredicateKind::Trait(self.value.to_poly_trait_predicate(), self.constness)
.to_predicate(tcx)
}
}
impl<'tcx> ToPredicate<'tcx> for PolyRegionOutlivesPredicate<'tcx> { impl<'tcx> ToPredicate<'tcx> for PolyRegionOutlivesPredicate<'tcx> {
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> { fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
PredicateKind::RegionOutlives(self).to_predicate(tcx) PredicateKind::RegionOutlives(self).to_predicate(tcx)

View file

@ -59,8 +59,8 @@ impl<'tcx> TraitAliasExpansionInfo<'tcx> {
); );
} }
pub fn trait_ref(&self) -> &ty::PolyTraitRef<'tcx> { pub fn trait_ref(&self) -> ty::PolyTraitRef<'tcx> {
&self.top().0 self.top().0
} }
pub fn top(&self) -> &(ty::PolyTraitRef<'tcx>, Span) { pub fn top(&self) -> &(ty::PolyTraitRef<'tcx>, Span) {
@ -109,7 +109,7 @@ impl<'tcx> TraitAliasExpander<'tcx> {
// Don't recurse if this trait alias is already on the stack for the DFS search. // Don't recurse if this trait alias is already on the stack for the DFS search.
let anon_pred = anonymize_predicate(tcx, pred); let anon_pred = anonymize_predicate(tcx, pred);
if item.path.iter().rev().skip(1).any(|(tr, _)| { if item.path.iter().rev().skip(1).any(|&(tr, _)| {
anonymize_predicate(tcx, tr.without_const().to_predicate(tcx)) == anon_pred anonymize_predicate(tcx, tr.without_const().to_predicate(tcx)) == anon_pred
}) { }) {
return false; return false;