Skip to content

Commit 08034eb

Browse files
committed
add Issue32330 warning marker to bound regions
This indicates whether this `BoundRegion` will change from late to early bound when issue 32330 is fixed. It also indicates the function on which the lifetime is declared.
1 parent 1198434 commit 08034eb

File tree

13 files changed

+313
-170
lines changed

13 files changed

+313
-170
lines changed

src/librustc/hir/intravisit.rs

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ pub trait Visitor<'v> : Sized {
132132
fn visit_generics(&mut self, g: &'v Generics) {
133133
walk_generics(self, g)
134134
}
135+
fn visit_where_predicate(&mut self, predicate: &'v WherePredicate) {
136+
walk_where_predicate(self, predicate)
137+
}
135138
fn visit_fn(&mut self, fk: FnKind<'v>, fd: &'v FnDecl, b: &'v Block, s: Span, _: NodeId) {
136139
walk_fn(self, fk, fd, b, s)
137140
}
@@ -529,29 +532,34 @@ pub fn walk_generics<'v, V: Visitor<'v>>(visitor: &mut V, generics: &'v Generics
529532
walk_list!(visitor, visit_ty, &param.default);
530533
}
531534
walk_list!(visitor, visit_lifetime_def, &generics.lifetimes);
532-
for predicate in &generics.where_clause.predicates {
533-
match predicate {
534-
&WherePredicate::BoundPredicate(WhereBoundPredicate{ref bounded_ty,
535-
ref bounds,
536-
ref bound_lifetimes,
537-
..}) => {
538-
visitor.visit_ty(bounded_ty);
539-
walk_list!(visitor, visit_ty_param_bound, bounds);
540-
walk_list!(visitor, visit_lifetime_def, bound_lifetimes);
541-
}
542-
&WherePredicate::RegionPredicate(WhereRegionPredicate{ref lifetime,
543-
ref bounds,
544-
..}) => {
545-
visitor.visit_lifetime(lifetime);
546-
walk_list!(visitor, visit_lifetime, bounds);
547-
}
548-
&WherePredicate::EqPredicate(WhereEqPredicate{id,
549-
ref path,
550-
ref ty,
551-
..}) => {
552-
visitor.visit_path(path, id);
553-
visitor.visit_ty(ty);
554-
}
535+
walk_list!(visitor, visit_where_predicate, &generics.where_clause.predicates);
536+
}
537+
538+
pub fn walk_where_predicate<'v, V: Visitor<'v>>(
539+
visitor: &mut V,
540+
predicate: &'v WherePredicate)
541+
{
542+
match predicate {
543+
&WherePredicate::BoundPredicate(WhereBoundPredicate{ref bounded_ty,
544+
ref bounds,
545+
ref bound_lifetimes,
546+
..}) => {
547+
visitor.visit_ty(bounded_ty);
548+
walk_list!(visitor, visit_ty_param_bound, bounds);
549+
walk_list!(visitor, visit_lifetime_def, bound_lifetimes);
550+
}
551+
&WherePredicate::RegionPredicate(WhereRegionPredicate{ref lifetime,
552+
ref bounds,
553+
..}) => {
554+
visitor.visit_lifetime(lifetime);
555+
walk_list!(visitor, visit_lifetime, bounds);
556+
}
557+
&WherePredicate::EqPredicate(WhereEqPredicate{id,
558+
ref path,
559+
ref ty,
560+
..}) => {
561+
visitor.visit_path(path, id);
562+
visitor.visit_ty(ty);
555563
}
556564
}
557565
}

src/librustc/infer/error_reporting.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ impl<'a, 'gcx, 'tcx> Rebuilder<'a, 'gcx, 'tcx> {
11401140
ty::BrAnon(i) => {
11411141
anon_nums.insert(i);
11421142
}
1143-
ty::BrNamed(_, name) => {
1143+
ty::BrNamed(_, name, _) => {
11441144
region_names.insert(name);
11451145
}
11461146
_ => ()
@@ -1154,7 +1154,7 @@ impl<'a, 'gcx, 'tcx> Rebuilder<'a, 'gcx, 'tcx> {
11541154
for sr in self.same_regions {
11551155
for br in &sr.regions {
11561156
match *br {
1157-
ty::BrNamed(_, name) => {
1157+
ty::BrNamed(_, name, _) => {
11581158
all_region_names.insert(name);
11591159
}
11601160
_ => ()

src/librustc/infer/higher_ranked/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@
1313
1414
use super::{CombinedSnapshot,
1515
InferCtxt,
16-
LateBoundRegion,
1716
HigherRankedType,
1817
SubregionOrigin,
1918
SkolemizationMap};
2019
use super::combine::CombineFields;
2120
use super::region_inference::{TaintDirections};
2221

23-
use infer::error_reporting;
2422
use ty::{self, TyCtxt, Binder, TypeFoldable};
2523
use ty::error::TypeError;
2624
use ty::relate::{Relate, RelateResult, TypeRelation};

0 commit comments

Comments
 (0)