@@ -1353,12 +1353,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1353
1353
} ) ,
1354
1354
) ;
1355
1355
1356
- let ( lifetimes_in_bounds, binders_to_ignore ) =
1357
- lifetime_collector:: lifetimes_in_bounds ( bounds) ;
1356
+ let lifetimes_in_bounds =
1357
+ lifetime_collector:: lifetimes_in_bounds ( & lctx . resolver , bounds) ;
1358
1358
debug ! ( ?lifetimes_in_bounds) ;
1359
- debug ! ( ?binders_to_ignore) ;
1360
1359
1361
- lctx. create_and_capture_lifetime_defs ( & lifetimes_in_bounds, & binders_to_ignore ) ;
1360
+ lctx. create_and_capture_lifetime_defs ( & lifetimes_in_bounds) ;
1362
1361
1363
1362
let ret = lctx. lower_param_bounds ( bounds, itctx) ;
1364
1363
@@ -1447,11 +1446,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1447
1446
hir:: OwnerNode :: Item ( self . arena . alloc ( opaque_ty_item) )
1448
1447
}
1449
1448
1450
- fn create_and_capture_lifetime_defs (
1451
- & mut self ,
1452
- lifetimes_in_bounds : & [ & Lifetime ] ,
1453
- binders_to_ignore : & FxHashMap < NodeId , Vec < NodeId > > ,
1454
- ) {
1449
+ fn create_and_capture_lifetime_defs ( & mut self , lifetimes_in_bounds : & [ & Lifetime ] ) {
1455
1450
for lifetime in lifetimes_in_bounds {
1456
1451
let ident = lifetime. ident ;
1457
1452
let span = ident. span ;
@@ -1461,53 +1456,41 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1461
1456
1462
1457
if let Some ( mut captured_lifetimes) = self . captured_lifetimes . take ( ) {
1463
1458
match res {
1464
- LifetimeRes :: Param { param, binder } => {
1465
- if !binders_to_ignore
1466
- . get ( & lifetime. id )
1467
- . unwrap_or ( & Vec :: new ( ) )
1468
- . contains ( & binder)
1469
- {
1470
- match captured_lifetimes. captures . entry ( param) {
1471
- Entry :: Occupied ( _) => { }
1472
- Entry :: Vacant ( v) => {
1473
- let node_id = self . next_node_id ( ) ;
1474
- let name = ParamName :: Plain ( ident) ;
1475
-
1476
- self . create_def (
1477
- captured_lifetimes. parent_def_id ,
1478
- node_id,
1479
- DefPathData :: LifetimeNs ( name. ident ( ) . name ) ,
1480
- ) ;
1481
-
1482
- v. insert ( ( span, node_id, name, res) ) ;
1483
- }
1459
+ LifetimeRes :: Param { param, binder : _ } => {
1460
+ match captured_lifetimes. captures . entry ( param) {
1461
+ Entry :: Occupied ( _) => { }
1462
+ Entry :: Vacant ( v) => {
1463
+ let node_id = self . next_node_id ( ) ;
1464
+ let name = ParamName :: Plain ( ident) ;
1465
+
1466
+ self . create_def (
1467
+ captured_lifetimes. parent_def_id ,
1468
+ node_id,
1469
+ DefPathData :: LifetimeNs ( name. ident ( ) . name ) ,
1470
+ ) ;
1471
+
1472
+ v. insert ( ( span, node_id, name, res) ) ;
1484
1473
}
1485
1474
}
1486
1475
}
1487
1476
1488
- LifetimeRes :: Fresh { param, binder } => {
1477
+ LifetimeRes :: Fresh { param, binder : _ } => {
1489
1478
debug_assert_eq ! ( ident. name, kw:: UnderscoreLifetime ) ;
1490
- if !binders_to_ignore
1491
- . get ( & lifetime. id )
1492
- . unwrap_or ( & Vec :: new ( ) )
1493
- . contains ( & binder)
1494
- {
1495
- let param = self . local_def_id ( param) ;
1496
- match captured_lifetimes. captures . entry ( param) {
1497
- Entry :: Occupied ( _) => { }
1498
- Entry :: Vacant ( v) => {
1499
- let node_id = self . next_node_id ( ) ;
1500
-
1501
- let name = ParamName :: Fresh ;
1502
-
1503
- self . create_def (
1504
- captured_lifetimes. parent_def_id ,
1505
- node_id,
1506
- DefPathData :: LifetimeNs ( kw:: UnderscoreLifetime ) ,
1507
- ) ;
1508
-
1509
- v. insert ( ( span, node_id, name, res) ) ;
1510
- }
1479
+ let param = self . local_def_id ( param) ;
1480
+ match captured_lifetimes. captures . entry ( param) {
1481
+ Entry :: Occupied ( _) => { }
1482
+ Entry :: Vacant ( v) => {
1483
+ let node_id = self . next_node_id ( ) ;
1484
+
1485
+ let name = ParamName :: Fresh ;
1486
+
1487
+ self . create_def (
1488
+ captured_lifetimes. parent_def_id ,
1489
+ node_id,
1490
+ DefPathData :: LifetimeNs ( kw:: UnderscoreLifetime ) ,
1491
+ ) ;
1492
+
1493
+ v. insert ( ( span, node_id, name, res) ) ;
1511
1494
}
1512
1495
}
1513
1496
}
@@ -1758,12 +1741,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1758
1741
} ) ,
1759
1742
) ;
1760
1743
1761
- let ( lifetimes_in_bounds, binders_to_ignore ) =
1762
- lifetime_collector:: lifetimes_in_ret_ty ( output) ;
1744
+ let lifetimes_in_bounds =
1745
+ lifetime_collector:: lifetimes_in_ret_ty ( & this . resolver , output) ;
1763
1746
debug ! ( ?lifetimes_in_bounds) ;
1764
- debug ! ( ?binders_to_ignore) ;
1765
1747
1766
- this. create_and_capture_lifetime_defs ( & lifetimes_in_bounds, & binders_to_ignore ) ;
1748
+ this. create_and_capture_lifetime_defs ( & lifetimes_in_bounds) ;
1767
1749
1768
1750
// We have to be careful to get elision right here. The
1769
1751
// idea is that we create a lifetime parameter for each
0 commit comments