Skip to content

Commit 3ba6192

Browse files
committed
this might be unqualified, but at least it's now quantified
1 parent 562d478 commit 3ba6192

File tree

38 files changed

+87
-83
lines changed

38 files changed

+87
-83
lines changed

src/librustc_infer/traits/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ impl Elaborator<'tcx> {
138138
fn elaborate(&mut self, obligation: &PredicateObligation<'tcx>) {
139139
let tcx = self.visited.tcx;
140140

141-
match obligation.predicate.ignore_qualifiers().skip_binder().kind() {
141+
match obligation.predicate.ignore_quantifiers().skip_binder().kind() {
142142
ty::PredicateKind::ForAll(_) => {
143143
bug!("unexpected predicate: {:?}", obligation.predicate)
144144
}

src/librustc_lint/builtin.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
12101210
for &(predicate, span) in predicates.predicates {
12111211
// We don't actually look inside of the predicate,
12121212
// so it is safe to skip this binder here.
1213-
let predicate_kind_name = match predicate.ignore_qualifiers().skip_binder().kind() {
1213+
let predicate_kind_name = match predicate.ignore_quantifiers().skip_binder().kind() {
12141214
Trait(..) => "Trait",
12151215
TypeOutlives(..) |
12161216
RegionOutlives(..) => "Lifetime",
@@ -1500,7 +1500,7 @@ impl ExplicitOutlivesRequirements {
15001500
) -> Vec<ty::Region<'tcx>> {
15011501
inferred_outlives
15021502
.iter()
1503-
.filter_map(|(pred, _)| match pred.ignore_qualifiers().skip_binder().kind() {
1503+
.filter_map(|(pred, _)| match pred.ignore_quantifiers().skip_binder().kind() {
15041504
&ty::PredicateKind::RegionOutlives(ty::OutlivesPredicate(a, b)) => match a {
15051505
ty::ReEarlyBound(ebr) if ebr.index == index => Some(b),
15061506
_ => None,
@@ -1516,7 +1516,7 @@ impl ExplicitOutlivesRequirements {
15161516
) -> Vec<ty::Region<'tcx>> {
15171517
inferred_outlives
15181518
.iter()
1519-
.filter_map(|(pred, _)| match pred.ignore_qualifiers().skip_binder().kind() {
1519+
.filter_map(|(pred, _)| match pred.ignore_quantifiers().skip_binder().kind() {
15201520
&ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(a, b)) => {
15211521
a.is_param(index).then_some(b)
15221522
}

src/librustc_lint/unused.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
148148
for (predicate, _) in cx.tcx.predicates_of(def).predicates {
149149
// We only look at the `DefId`, so it is safe to skip the binder here.
150150
if let ty::PredicateKind::Trait(ref poly_trait_predicate, _) =
151-
predicate.ignore_qualifiers().skip_binder().kind()
151+
predicate.ignore_quantifiers().skip_binder().kind()
152152
{
153153
let def_id = poly_trait_predicate.trait_ref.def_id;
154154
let descr_pre =

src/librustc_middle/ty/mod.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ impl<'tcx> Predicate<'tcx> {
10501050
}
10511051

10521052
/// Skips `PredicateKind::ForAll`.
1053-
pub fn ignore_qualifiers(self) -> Binder<Predicate<'tcx>> {
1053+
pub fn ignore_quantifiers(self) -> Binder<Predicate<'tcx>> {
10541054
match self.kind() {
10551055
&PredicateKind::ForAll(binder) => binder,
10561056
ty::PredicateKind::Projection(..)
@@ -1073,7 +1073,10 @@ impl<'tcx> Predicate<'tcx> {
10731073
///
10741074
/// Do not use this method if you may end up just skipping the binder, as this
10751075
/// would leave the unbound variables at an incorrect binding level.
1076-
pub fn ignore_qualifiers_with_unbound_vars(self, tcx: TyCtxt<'tcx>) -> Binder<Predicate<'tcx>> {
1076+
pub fn ignore_quantifiers_with_unbound_vars(
1077+
self,
1078+
tcx: TyCtxt<'tcx>,
1079+
) -> Binder<Predicate<'tcx>> {
10771080
match self.kind() {
10781081
&PredicateKind::ForAll(binder) => binder,
10791082
ty::PredicateKind::Projection(..)
@@ -1090,7 +1093,7 @@ impl<'tcx> Predicate<'tcx> {
10901093
}
10911094

10921095
/// Wraps `self` with the given qualifier if this predicate has any unbound variables.
1093-
pub fn potentially_qualified(
1096+
pub fn potentially_quantified(
10941097
self,
10951098
tcx: TyCtxt<'tcx>,
10961099
qualifier: impl FnOnce(Binder<Predicate<'tcx>>) -> PredicateKind<'tcx>,
@@ -1249,9 +1252,9 @@ impl<'tcx> Predicate<'tcx> {
12491252
// from the substitution and the value being substituted into, and
12501253
// this trick achieves that).
12511254
let substs = trait_ref.skip_binder().substs;
1252-
let pred = *self.ignore_qualifiers().skip_binder();
1255+
let pred = *self.ignore_quantifiers().skip_binder();
12531256
let new = pred.subst(tcx, substs);
1254-
if new != pred { new.potentially_qualified(tcx, PredicateKind::ForAll) } else { self }
1257+
if new != pred { new.potentially_quantified(tcx, PredicateKind::ForAll) } else { self }
12551258
}
12561259
}
12571260

@@ -1451,7 +1454,7 @@ impl<'tcx> ToPredicate<'tcx> for PolyProjectionPredicate<'tcx> {
14511454

14521455
impl<'tcx> Predicate<'tcx> {
14531456
pub fn to_opt_poly_trait_ref(self) -> Option<PolyTraitRef<'tcx>> {
1454-
self.ignore_qualifiers()
1457+
self.ignore_quantifiers()
14551458
.map_bound(|pred| match pred.kind() {
14561459
&PredicateKind::Trait(ref t, _) => Some(t.trait_ref),
14571460
PredicateKind::Projection(..)
@@ -1469,7 +1472,7 @@ impl<'tcx> Predicate<'tcx> {
14691472
}
14701473

14711474
pub fn to_opt_type_outlives(self) -> Option<PolyTypeOutlivesPredicate<'tcx>> {
1472-
self.ignore_qualifiers()
1475+
self.ignore_quantifiers()
14731476
.map_bound(|pred| match pred.kind() {
14741477
&PredicateKind::TypeOutlives(data) => Some(data),
14751478
PredicateKind::Trait(..)

src/librustc_middle/ty/print/pretty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ pub trait PrettyPrinter<'tcx>:
577577
//
578578
// FIXME(lcnr): Find out why exactly this is the case :)
579579
if let ty::PredicateKind::Trait(pred, _) = predicate
580-
.ignore_qualifiers_with_unbound_vars(self.tcx())
580+
.ignore_quantifiers_with_unbound_vars(self.tcx())
581581
.skip_binder()
582582
.kind()
583583
{

src/librustc_mir/borrow_check/diagnostics/region_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
590590
let mut found = false;
591591
for predicate in bounds.predicates {
592592
if let ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(_, r)) =
593-
predicate.ignore_qualifiers().skip_binder().kind()
593+
predicate.ignore_quantifiers().skip_binder().kind()
594594
{
595595
if let ty::RegionKind::ReStatic = r {
596596
found = true;

src/librustc_mir/transform/qualify_min_const_fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn is_min_const_fn(tcx: TyCtxt<'tcx>, def_id: DefId, body: &'a Body<'tcx>) -
2424
loop {
2525
let predicates = tcx.predicates_of(current);
2626
for (predicate, _) in predicates.predicates {
27-
match predicate.ignore_qualifiers().skip_binder().kind() {
27+
match predicate.ignore_quantifiers().skip_binder().kind() {
2828
ty::PredicateKind::ForAll(_) => bug!("unexpected predicate: {:?}", predicate),
2929
ty::PredicateKind::RegionOutlives(_)
3030
| ty::PredicateKind::TypeOutlives(_)

src/librustc_trait_selection/opaque_types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
11551155

11561156
for predicate in &bounds.predicates {
11571157
if let ty::PredicateKind::Projection(projection) =
1158-
predicate.ignore_qualifiers().skip_binder().kind()
1158+
predicate.ignore_quantifiers().skip_binder().kind()
11591159
{
11601160
if projection.ty.references_error() {
11611161
// No point on adding these obligations since there's a type error involved.
@@ -1254,7 +1254,7 @@ crate fn required_region_bounds(
12541254
traits::elaborate_predicates(tcx, predicates)
12551255
.filter_map(|obligation| {
12561256
debug!("required_region_bounds(obligation={:?})", obligation);
1257-
match obligation.predicate.ignore_qualifiers().skip_binder().kind() {
1257+
match obligation.predicate.ignore_quantifiers().skip_binder().kind() {
12581258
ty::PredicateKind::Projection(..)
12591259
| ty::PredicateKind::Trait(..)
12601260
| ty::PredicateKind::Subtype(..)

src/librustc_trait_selection/traits/auto_trait.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,8 @@ impl AutoTraitFinder<'tcx> {
418418
ty::PredicateKind::Trait(new_trait, _),
419419
ty::PredicateKind::Trait(old_trait, _),
420420
) = (
421-
new_pred.ignore_qualifiers().skip_binder().kind(),
422-
old_pred.ignore_qualifiers().skip_binder().kind(),
421+
new_pred.ignore_quantifiers().skip_binder().kind(),
422+
old_pred.ignore_quantifiers().skip_binder().kind(),
423423
) {
424424
if new_trait.def_id() == old_trait.def_id() {
425425
let new_substs = new_trait.trait_ref.substs;
@@ -639,7 +639,7 @@ impl AutoTraitFinder<'tcx> {
639639
// We check this by calling is_of_param on the relevant types
640640
// from the various possible predicates
641641

642-
match predicate.ignore_qualifiers().skip_binder().kind() {
642+
match predicate.ignore_quantifiers().skip_binder().kind() {
643643
&ty::PredicateKind::Trait(p, _) => {
644644
if self.is_param_no_infer(p.trait_ref.substs)
645645
&& !only_projections

src/librustc_trait_selection/traits/error_reporting/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
256256
return;
257257
}
258258

259-
match obligation.predicate.ignore_qualifiers().skip_binder().kind() {
259+
match obligation.predicate.ignore_quantifiers().skip_binder().kind() {
260260
ty::PredicateKind::ForAll(_) => {
261261
bug!("unexpected predicate: {:?}", obligation.predicate)
262262
}
@@ -1091,8 +1091,8 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
10911091

10921092
// FIXME: It should be possible to deal with `ForAll` in a cleaner way.
10931093
let (cond, error) = match (
1094-
cond.ignore_qualifiers().skip_binder().kind(),
1095-
error.ignore_qualifiers().skip_binder().kind(),
1094+
cond.ignore_quantifiers().skip_binder().kind(),
1095+
error.ignore_quantifiers().skip_binder().kind(),
10961096
) {
10971097
(ty::PredicateKind::Trait(..), &ty::PredicateKind::Trait(error, _)) => {
10981098
(cond, ty::Binder::bind(error))
@@ -1105,7 +1105,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
11051105

11061106
for obligation in super::elaborate_predicates(self.tcx, std::iter::once(cond)) {
11071107
if let &ty::PredicateKind::Trait(implication, _) =
1108-
obligation.predicate.ignore_qualifiers().skip_binder().kind()
1108+
obligation.predicate.ignore_quantifiers().skip_binder().kind()
11091109
{
11101110
let error = error.to_poly_trait_ref();
11111111
let implication = ty::Binder::bind(implication).to_poly_trait_ref();
@@ -1187,7 +1187,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
11871187
// this can fail if the problem was higher-ranked, in which
11881188
// cause I have no idea for a good error message.
11891189
if let &ty::PredicateKind::Projection(data) =
1190-
predicate.ignore_qualifiers().skip_binder().kind()
1190+
predicate.ignore_quantifiers().skip_binder().kind()
11911191
{
11921192
let mut selcx = SelectionContext::new(self);
11931193
let (data, _) = self.replace_bound_vars_with_fresh_vars(
@@ -1480,7 +1480,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
14801480
return;
14811481
}
14821482

1483-
let mut err = match predicate.ignore_qualifiers().skip_binder().kind() {
1483+
let mut err = match predicate.ignore_quantifiers().skip_binder().kind() {
14841484
&ty::PredicateKind::Trait(data, _) => {
14851485
let trait_ref = ty::Binder::bind(data.trait_ref);
14861486
let self_ty = trait_ref.skip_binder().self_ty();
@@ -1734,7 +1734,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
17341734
obligation: &PredicateObligation<'tcx>,
17351735
) {
17361736
let (pred, item_def_id, span) = match (
1737-
obligation.predicate.ignore_qualifiers().skip_binder().kind(),
1737+
obligation.predicate.ignore_quantifiers().skip_binder().kind(),
17381738
obligation.cause.code.peel_derives(),
17391739
) {
17401740
(

0 commit comments

Comments
 (0)