Skip to content

Commit

Permalink
fix rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Jul 27, 2020
1 parent cd9743b commit 825cb5b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/librustc_infer/infer/outlives/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(..)
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(..) |
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_middle/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
48 changes: 25 additions & 23 deletions src/librustc_trait_selection/traits/fulfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

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)
ty::PredicateAtom::ConstEquate(c1, c2) => {
debug!("equating consts: c1={:?} c2={:?}", c1, c2);

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)
}
Err(err) => Err(err),
}
} else {
Ok(c)
Expand Down

0 comments on commit 825cb5b

Please sign in to comment.