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()
.into_iter()
.map(ty::Predicate::skip_binders)
.filter(TypeFoldable::has_escaping_bound_vars)
.filter(|atom| !atom.has_escaping_bound_vars())
.filter_map(move |atom| match atom {
ty::PredicateAtom::Projection(..)
| 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 predicates = cx.tcx.predicates_of(def_id);
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() {
Trait(..) => "Trait",
TypeOutlives(..) |

View file

@ -1377,14 +1377,14 @@ impl ToPredicate<'tcx> for PredicateKind<'tcx> {
impl ToPredicate<'tcx> for PredicateAtom<'tcx> {
#[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);
tcx.mk_predicate(ty::PredicateKind::Atom(*self))
tcx.mk_predicate(ty::PredicateKind::Atom(self))
}
}
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)
.to_predicate(tcx)
}

View file

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