Skip to content

Commit 75772a8

Browse files
committed
and all is well
1 parent 78d8f6f commit 75772a8

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

src/librustc_middle/ty/mod.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1220,11 +1220,7 @@ impl<'tcx> Predicate<'tcx> {
12201220
let substs = trait_ref.skip_binder().substs;
12211221
let pred = *self.ignore_qualifiers(tcx).skip_binder();
12221222
let new = pred.subst(tcx, substs);
1223-
if new != pred {
1224-
new.potentially_qualified(tcx, PredicateKind::ForAll)
1225-
} else {
1226-
self
1227-
}
1223+
if new != pred { new.potentially_qualified(tcx, PredicateKind::ForAll) } else { self }
12281224
}
12291225
}
12301226

src/librustc_trait_selection/traits/error_reporting/mod.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -1712,14 +1712,16 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
17121712
err: &mut DiagnosticBuilder<'tcx>,
17131713
obligation: &PredicateObligation<'tcx>,
17141714
) {
1715-
let (pred, item_def_id, span) =
1716-
match (obligation.predicate.ignore_qualifiers(self.tcx).skip_binder().kind(), obligation.cause.code.peel_derives()) {
1717-
(
1718-
ty::PredicateKind::Trait(pred, _),
1719-
&ObligationCauseCode::BindingObligation(item_def_id, span),
1720-
) => (pred, item_def_id, span),
1721-
_ => return,
1722-
};
1715+
let (pred, item_def_id, span) = match (
1716+
obligation.predicate.ignore_qualifiers(self.tcx).skip_binder().kind(),
1717+
obligation.cause.code.peel_derives(),
1718+
) {
1719+
(
1720+
ty::PredicateKind::Trait(pred, _),
1721+
&ObligationCauseCode::BindingObligation(item_def_id, span),
1722+
) => (pred, item_def_id, span),
1723+
_ => return,
1724+
};
17231725

17241726
let node = match (
17251727
self.tcx.hir().get_if_local(item_def_id),

src/librustc_traits/chalk/lowering.rs

+15-3
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,21 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::GoalData<RustInterner<'tcx>>> for ty::Predi
218218
// the environment.
219219
ty::Placeholder(..) => chalk_ir::GoalData::All(chalk_ir::Goals::new(interner)),
220220

221-
_ => chalk_ir::GoalData::DomainGoal(chalk_ir::DomainGoal::WellFormed(
222-
chalk_ir::WellFormed::Ty(ty.lower_into(interner)),
223-
)),
221+
_ => {
222+
let (ty, binders, _named_regions) =
223+
collect_bound_vars(interner, interner.tcx, &ty::Binder::bind(ty));
224+
225+
chalk_ir::GoalData::Quantified(
226+
chalk_ir::QuantifierKind::ForAll,
227+
chalk_ir::Binders::new(
228+
binders,
229+
chalk_ir::GoalData::DomainGoal(chalk_ir::DomainGoal::WellFormed(
230+
chalk_ir::WellFormed::Ty(ty.lower_into(interner)),
231+
))
232+
.intern(interner),
233+
),
234+
)
235+
}
224236
},
225237
// FIXME(chalk): handle well formed consts
226238
GenericArgKind::Const(..) => {

0 commit comments

Comments
 (0)