@@ -137,13 +137,10 @@ struct LoweringContext<'a, 'hir> {
137
137
#[ derive( Debug ) ]
138
138
struct LifetimeCaptureContext {
139
139
/// Set of lifetimes to rebind.
140
- captures : FxHashMap <
141
- LocalDefId , // original parameter id
142
- (
143
- Lifetime , // Lifetime parameter
144
- LifetimeRes , // original resolution
145
- ) ,
146
- > ,
140
+ captures : Vec < (
141
+ Lifetime , // Lifetime parameter
142
+ LifetimeRes , // original resolution
143
+ ) > ,
147
144
}
148
145
149
146
trait ResolverAstLoweringExt {
@@ -1324,7 +1321,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1324
1321
1325
1322
let opaque_ty_def_id = self . local_def_id ( opaque_ty_node_id) ;
1326
1323
1327
- let mut collected_lifetimes = FxHashMap :: default ( ) ;
1324
+ let mut collected_lifetimes = Vec :: new ( ) ;
1328
1325
let mut new_remapping = FxHashMap :: default ( ) ;
1329
1326
1330
1327
self . with_hir_id_owner ( opaque_ty_node_id, |lctx| {
@@ -1360,8 +1357,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1360
1357
} ;
1361
1358
debug ! ( ?collected_lifetimes) ;
1362
1359
1363
- let lifetime_defs = lctx . arena . alloc_from_iter ( collected_lifetimes . iter ( ) . map (
1364
- | ( _ , & ( lifetime, _) ) | {
1360
+ let lifetime_defs =
1361
+ lctx . arena . alloc_from_iter ( collected_lifetimes . iter ( ) . map ( | & ( lifetime, _) | {
1365
1362
let hir_id = lctx. lower_node_id ( lifetime. id ) ;
1366
1363
debug_assert_ne ! ( lctx. opt_local_def_id( lifetime. id) , None ) ;
1367
1364
@@ -1379,8 +1376,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1379
1376
kind : hir:: GenericParamKind :: Lifetime { kind } ,
1380
1377
colon_span : None ,
1381
1378
}
1382
- } ,
1383
- ) ) ;
1379
+ } ) ) ;
1384
1380
1385
1381
debug ! ( "lower_opaque_impl_trait: lifetime_defs={:#?}" , lifetime_defs) ;
1386
1382
@@ -1400,8 +1396,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1400
1396
lctx. generate_opaque_type ( opaque_ty_def_id, opaque_ty_item, span, opaque_ty_span)
1401
1397
} ) ;
1402
1398
1403
- let lifetimes = self . arena . alloc_from_iter ( collected_lifetimes . into_iter ( ) . map (
1404
- | ( _ , ( lifetime, res) ) | {
1399
+ let lifetimes =
1400
+ self . arena . alloc_from_iter ( collected_lifetimes . into_iter ( ) . map ( | ( lifetime, res) | {
1405
1401
let id = self . next_node_id ( ) ;
1406
1402
let span = lifetime. ident . span ;
1407
1403
@@ -1413,8 +1409,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1413
1409
1414
1410
let l = self . new_named_lifetime_with_res ( id, span, ident, res) ;
1415
1411
hir:: GenericArg :: Lifetime ( l)
1416
- } ,
1417
- ) ) ;
1412
+ } ) ) ;
1418
1413
1419
1414
debug ! ( "lower_opaque_impl_trait: lifetimes={:#?}" , lifetimes) ;
1420
1415
@@ -1468,7 +1463,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1468
1463
remapping. insert ( old_def_id, new_def_id) ;
1469
1464
1470
1465
let new_lifetime = Lifetime { id : node_id, ident : lifetime. ident } ;
1471
- captured_lifetimes. captures . insert ( old_def_id , ( new_lifetime, res) ) ;
1466
+ captured_lifetimes. captures . push ( ( new_lifetime, res) ) ;
1472
1467
}
1473
1468
}
1474
1469
@@ -1486,7 +1481,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1486
1481
remapping. insert ( old_def_id, new_def_id) ;
1487
1482
1488
1483
let new_lifetime = Lifetime { id : node_id, ident : lifetime. ident } ;
1489
- captured_lifetimes. captures . insert ( old_def_id , ( new_lifetime, res) ) ;
1484
+ captured_lifetimes. captures . push ( ( new_lifetime, res) ) ;
1490
1485
}
1491
1486
}
1492
1487
@@ -1694,7 +1689,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1694
1689
// by the opaque type. This should include all in-scope
1695
1690
// lifetime parameters, including those defined in-band.
1696
1691
1697
- let mut captures = FxHashMap :: default ( ) ;
1692
+ let mut captures = Vec :: new ( ) ;
1698
1693
let mut new_remapping = FxHashMap :: default ( ) ;
1699
1694
1700
1695
let extra_lifetime_params = self . resolver . take_extra_lifetime_params ( opaque_ty_node_id) ;
@@ -1730,7 +1725,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1730
1725
} ;
1731
1726
1732
1727
let new_lifetime = Lifetime { id : inner_node_id, ident } ;
1733
- captures. insert ( outer_def_id , ( new_lifetime, inner_res) ) ;
1728
+ captures. push ( ( new_lifetime, inner_res) ) ;
1734
1729
}
1735
1730
1736
1731
debug ! ( ?captures) ;
@@ -1768,7 +1763,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1768
1763
let future_bound = ret;
1769
1764
1770
1765
let generic_params =
1771
- this. arena . alloc_from_iter ( captures. iter ( ) . map ( |( _ , & ( lifetime, _) ) | {
1766
+ this. arena . alloc_from_iter ( captures. iter ( ) . map ( |& ( lifetime, _) | {
1772
1767
let hir_id = this. lower_node_id ( lifetime. id ) ;
1773
1768
debug_assert_ne ! ( this. opt_local_def_id( lifetime. id) , None ) ;
1774
1769
@@ -1821,7 +1816,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1821
1816
// For the "output" lifetime parameters, we just want to
1822
1817
// generate `'_`.
1823
1818
let generic_args =
1824
- self . arena . alloc_from_iter ( captures. into_iter ( ) . map ( |( _ , ( lifetime, res) ) | {
1819
+ self . arena . alloc_from_iter ( captures. into_iter ( ) . map ( |( lifetime, res) | {
1825
1820
let id = self . next_node_id ( ) ;
1826
1821
let span = lifetime. ident . span ;
1827
1822
0 commit comments