@@ -153,10 +153,6 @@ pub struct NamedRegionMap {
153
153
// (b) it DOES appear in the arguments.
154
154
pub late_bound : NodeSet ,
155
155
156
- // Contains the node-ids for lifetimes that were (incorrectly) categorized
157
- // as late-bound, until #32330 was fixed.
158
- pub issue_32330 : NodeMap < ty:: Issue32330 > ,
159
-
160
156
// For each type and trait definition, maps type parameters
161
157
// to the trait object lifetime defaults computed from them.
162
158
pub object_lifetime_defaults : NodeMap < Vec < ObjectLifetimeDefault > > ,
@@ -261,7 +257,6 @@ pub fn krate(sess: &Session,
261
257
let mut map = NamedRegionMap {
262
258
defs : NodeMap ( ) ,
263
259
late_bound : NodeSet ( ) ,
264
- issue_32330 : NodeMap ( ) ,
265
260
object_lifetime_defaults : compute_object_lifetime_defaults ( sess, hir_map) ,
266
261
} ;
267
262
sess. track_errors ( || {
@@ -303,7 +298,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
303
298
fn visit_item ( & mut self , item : & ' tcx hir:: Item ) {
304
299
match item. node {
305
300
hir:: ItemFn ( ref decl, _, _, _, ref generics, _) => {
306
- self . visit_early_late ( item . id , None , decl, generics, |this| {
301
+ self . visit_early_late ( None , decl, generics, |this| {
307
302
intravisit:: walk_item ( this, item) ;
308
303
} ) ;
309
304
}
@@ -355,7 +350,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
355
350
fn visit_foreign_item ( & mut self , item : & ' tcx hir:: ForeignItem ) {
356
351
match item. node {
357
352
hir:: ForeignItemFn ( ref decl, _, ref generics) => {
358
- self . visit_early_late ( item . id , None , decl, generics, |this| {
353
+ self . visit_early_late ( None , decl, generics, |this| {
359
354
intravisit:: walk_foreign_item ( this, item) ;
360
355
} )
361
356
}
@@ -406,7 +401,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
406
401
fn visit_trait_item ( & mut self , trait_item : & ' tcx hir:: TraitItem ) {
407
402
if let hir:: TraitItemKind :: Method ( ref sig, _) = trait_item. node {
408
403
self . visit_early_late (
409
- trait_item. id ,
410
404
Some ( self . hir_map . get_parent ( trait_item. id ) ) ,
411
405
& sig. decl , & sig. generics ,
412
406
|this| intravisit:: walk_trait_item ( this, trait_item) )
@@ -418,7 +412,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
418
412
fn visit_impl_item ( & mut self , impl_item : & ' tcx hir:: ImplItem ) {
419
413
if let hir:: ImplItemKind :: Method ( ref sig, _) = impl_item. node {
420
414
self . visit_early_late (
421
- impl_item. id ,
422
415
Some ( self . hir_map . get_parent ( impl_item. id ) ) ,
423
416
& sig. decl , & sig. generics ,
424
417
|this| intravisit:: walk_impl_item ( this, impl_item) )
@@ -811,18 +804,13 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
811
804
/// bound lifetimes are resolved by name and associated with a binder id (`binder_id`), so the
812
805
/// ordering is not important there.
813
806
fn visit_early_late < F > ( & mut self ,
814
- fn_id : ast:: NodeId ,
815
807
parent_id : Option < ast:: NodeId > ,
816
808
decl : & ' tcx hir:: FnDecl ,
817
809
generics : & ' tcx hir:: Generics ,
818
810
walk : F ) where
819
811
F : for <' b , ' c > FnOnce ( & ' b mut LifetimeContext < ' c , ' tcx > ) ,
820
812
{
821
- let fn_def_id = self . hir_map . local_def_id ( fn_id) ;
822
- insert_late_bound_lifetimes ( self . map ,
823
- fn_def_id,
824
- decl,
825
- generics) ;
813
+ insert_late_bound_lifetimes ( self . map , decl, generics) ;
826
814
827
815
// Find the start of nested early scopes, e.g. in methods.
828
816
let mut index = 0 ;
@@ -1549,7 +1537,6 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
1549
1537
/// not amongst the inputs to a projection. In other words, `<&'a
1550
1538
/// T as Trait<''b>>::Foo` does not constrain `'a` or `'b`.
1551
1539
fn insert_late_bound_lifetimes ( map : & mut NamedRegionMap ,
1552
- fn_def_id : DefId ,
1553
1540
decl : & hir:: FnDecl ,
1554
1541
generics : & hir:: Generics ) {
1555
1542
debug ! ( "insert_late_bound_lifetimes(decl={:?}, generics={:?})" , decl, generics) ;
@@ -1607,22 +1594,9 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap,
1607
1594
// any `impl Trait` in the return type? early-bound.
1608
1595
if appears_in_output. impl_trait { continue ; }
1609
1596
1610
- // does not appear in the inputs, but appears in the return
1611
- // type? eventually this will be early-bound, but for now we
1612
- // just mark it so we can issue warnings.
1613
- let constrained_by_input = constrained_by_input. regions . contains ( & name) ;
1614
- let appears_in_output = appears_in_output. regions . contains ( & name) ;
1615
- if !constrained_by_input && appears_in_output {
1616
- debug ! ( "inserting issue_32330 entry for {:?}, {:?} on {:?}" ,
1617
- lifetime. lifetime. id,
1618
- name,
1619
- fn_def_id) ;
1620
- map. issue_32330 . insert (
1621
- lifetime. lifetime . id ,
1622
- ty:: Issue32330 {
1623
- fn_def_id,
1624
- region_name : name,
1625
- } ) ;
1597
+ // does not appear in the inputs, but appears in the return type? early-bound.
1598
+ if !constrained_by_input. regions . contains ( & name) &&
1599
+ appears_in_output. regions . contains ( & name) {
1626
1600
continue ;
1627
1601
}
1628
1602
0 commit comments