fix rebase

This commit is contained in:
Bastian Kauschke 2020-07-18 12:06:47 +02:00
parent cd9743b4d4
commit 825cb5bdc9
4 changed files with 27 additions and 27 deletions

View file

@ -16,7 +16,7 @@ pub fn explicit_outlives_bounds<'tcx>(
.caller_bounds() .caller_bounds()
.into_iter() .into_iter()
.map(ty::Predicate::skip_binders) .map(ty::Predicate::skip_binders)
.filter(TypeFoldable::has_escaping_bound_vars) .filter(|atom| !atom.has_escaping_bound_vars())
.filter_map(move |atom| match atom { .filter_map(move |atom| match atom {
ty::PredicateAtom::Projection(..) ty::PredicateAtom::Projection(..)
| ty::PredicateAtom::Trait(..) | ty::PredicateAtom::Trait(..)

View file

@ -1208,8 +1208,6 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
let def_id = cx.tcx.hir().local_def_id(item.hir_id); let def_id = cx.tcx.hir().local_def_id(item.hir_id);
let predicates = cx.tcx.predicates_of(def_id); let predicates = cx.tcx.predicates_of(def_id);
for &(predicate, span) in predicates.predicates { for &(predicate, span) in predicates.predicates {
// We don't actually look inside of the predicate,
// so it is safe to skip this binder here.
let predicate_kind_name = match predicate.skip_binders() { let predicate_kind_name = match predicate.skip_binders() {
Trait(..) => "Trait", Trait(..) => "Trait",
TypeOutlives(..) | TypeOutlives(..) |

View file

@ -1377,14 +1377,14 @@ impl ToPredicate<'tcx> for PredicateKind<'tcx> {
impl ToPredicate<'tcx> for PredicateAtom<'tcx> { impl ToPredicate<'tcx> for PredicateAtom<'tcx> {
#[inline(always)] #[inline(always)]
fn to_predicate(&self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> { fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
debug_assert!(!self.has_escaping_bound_vars(), "excaping bound vars for {:?}", self); debug_assert!(!self.has_escaping_bound_vars(), "excaping bound vars for {:?}", self);
tcx.mk_predicate(ty::PredicateKind::Atom(*self)) tcx.mk_predicate(ty::PredicateKind::Atom(self))
} }
} }
impl<'tcx> ToPredicate<'tcx> for ConstnessAnd<TraitRef<'tcx>> { impl<'tcx> ToPredicate<'tcx> for ConstnessAnd<TraitRef<'tcx>> {
fn to_predicate(&self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> { fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
ty::PredicateAtom::Trait(ty::TraitPredicate { trait_ref: self.value }, self.constness) ty::PredicateAtom::Trait(ty::TraitPredicate { trait_ref: self.value }, self.constness)
.to_predicate(tcx) .to_predicate(tcx)
} }

View file

@ -471,29 +471,31 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
} }
} }
ty::PredicateAtom::ConstEquate(c1, c2) => { ty::PredicateAtom::ConstEquate(c1, c2) => {
debug!("equating consts: c1={:?} c2={:?}", c1, c2); debug!("equating consts: c1={:?} c2={:?}", c1, c2);
let stalled_on = &mut pending_obligation.stalled_on; let stalled_on = &mut pending_obligation.stalled_on;
let mut evaluate = |c: &'tcx Const<'tcx>| { let mut evaluate = |c: &'tcx Const<'tcx>| {
if let ty::ConstKind::Unevaluated(def, substs, promoted) = c.val { if let ty::ConstKind::Unevaluated(def, substs, promoted) = c.val {
match self.selcx.infcx().const_eval_resolve( match self.selcx.infcx().const_eval_resolve(
obligation.param_env, obligation.param_env,
def, def,
substs, substs,
promoted, promoted,
Some(obligation.cause.span), Some(obligation.cause.span),
) { ) {
Ok(val) => Ok(Const::from_value(self.selcx.tcx(), val, c.ty)), Ok(val) => Ok(Const::from_value(self.selcx.tcx(), val, c.ty)),
Err(ErrorHandled::TooGeneric) => { Err(ErrorHandled::TooGeneric) => {
stalled_on.append( stalled_on.append(
&mut substs &mut substs
.types() .types()
.filter_map(|ty| TyOrConstInferVar::maybe_from_ty(ty)) .filter_map(|ty| TyOrConstInferVar::maybe_from_ty(ty))
.collect(), .collect(),
); );
Err(ErrorHandled::TooGeneric) Err(ErrorHandled::TooGeneric)
}
Err(err) => Err(err),
} }
} else { } else {
Ok(c) Ok(c)