@@ -469,8 +469,8 @@ impl<'a> LoweringContext<'a> {
469
469
470
470
fn visit_trait_item ( & mut self , item : & ' lcx TraitItem ) {
471
471
self . lctx . with_hir_id_owner ( item. id , |lctx| {
472
- let id = hir:: TraitItemId { node_id : item. id } ;
473
472
let hir_item = lctx. lower_trait_item ( item) ;
473
+ let id = hir:: TraitItemId { hir_id : hir_item. hir_id } ;
474
474
lctx. trait_items . insert ( id, hir_item) ;
475
475
lctx. modules . get_mut ( & lctx. current_module ) . unwrap ( ) . trait_items . insert ( id) ;
476
476
} ) ;
@@ -480,8 +480,8 @@ impl<'a> LoweringContext<'a> {
480
480
481
481
fn visit_impl_item ( & mut self , item : & ' lcx ImplItem ) {
482
482
self . lctx . with_hir_id_owner ( item. id , |lctx| {
483
- let id = hir:: ImplItemId { node_id : item. id } ;
484
483
let hir_item = lctx. lower_impl_item ( item) ;
484
+ let id = hir:: ImplItemId { hir_id : hir_item. hir_id } ;
485
485
lctx. impl_items . insert ( id, hir_item) ;
486
486
lctx. modules . get_mut ( & lctx. current_module ) . unwrap ( ) . impl_items . insert ( id) ;
487
487
} ) ;
@@ -1414,7 +1414,6 @@ impl<'a> LoweringContext<'a> {
1414
1414
1415
1415
trace ! ( "exist ty def index: {:#?}" , exist_ty_def_index) ;
1416
1416
let exist_ty_item = hir:: Item {
1417
- id : exist_ty_id. node_id ,
1418
1417
hir_id : exist_ty_id. hir_id ,
1419
1418
ident : keywords:: Invalid . ident ( ) ,
1420
1419
attrs : Default :: default ( ) ,
@@ -2675,35 +2674,33 @@ impl<'a> LoweringContext<'a> {
2675
2674
fn lower_variant_data ( & mut self , vdata : & VariantData ) -> hir:: VariantData {
2676
2675
match * vdata {
2677
2676
VariantData :: Struct ( ref fields, id) => {
2678
- let LoweredNodeId { node_id, hir_id } = self . lower_node_id ( id) ;
2677
+ let LoweredNodeId { node_id : _ , hir_id } = self . lower_node_id ( id) ;
2679
2678
2680
2679
hir:: VariantData :: Struct (
2681
2680
fields
2682
2681
. iter ( )
2683
2682
. enumerate ( )
2684
2683
. map ( |f| self . lower_struct_field ( f) )
2685
2684
. collect ( ) ,
2686
- node_id,
2687
2685
hir_id,
2688
2686
)
2689
2687
} ,
2690
2688
VariantData :: Tuple ( ref fields, id) => {
2691
- let LoweredNodeId { node_id, hir_id } = self . lower_node_id ( id) ;
2689
+ let LoweredNodeId { node_id : _ , hir_id } = self . lower_node_id ( id) ;
2692
2690
2693
2691
hir:: VariantData :: Tuple (
2694
2692
fields
2695
2693
. iter ( )
2696
2694
. enumerate ( )
2697
2695
. map ( |f| self . lower_struct_field ( f) )
2698
2696
. collect ( ) ,
2699
- node_id,
2700
2697
hir_id,
2701
2698
)
2702
2699
} ,
2703
2700
VariantData :: Unit ( id) => {
2704
- let LoweredNodeId { node_id, hir_id } = self . lower_node_id ( id) ;
2701
+ let LoweredNodeId { node_id : _ , hir_id } = self . lower_node_id ( id) ;
2705
2702
2706
- hir:: VariantData :: Unit ( node_id , hir_id)
2703
+ hir:: VariantData :: Unit ( hir_id)
2707
2704
} ,
2708
2705
}
2709
2706
}
@@ -2743,11 +2740,10 @@ impl<'a> LoweringContext<'a> {
2743
2740
}
2744
2741
2745
2742
fn lower_struct_field ( & mut self , ( index, f) : ( usize , & StructField ) ) -> hir:: StructField {
2746
- let LoweredNodeId { node_id, hir_id } = self . lower_node_id ( f. id ) ;
2743
+ let LoweredNodeId { node_id : _ , hir_id } = self . lower_node_id ( f. id ) ;
2747
2744
2748
2745
hir:: StructField {
2749
2746
span : f. span ,
2750
- id : node_id,
2751
2747
hir_id,
2752
2748
ident : match f. ident {
2753
2749
Some ( ident) => ident,
@@ -3129,7 +3125,6 @@ impl<'a> LoweringContext<'a> {
3129
3125
this. insert_item (
3130
3126
new_id. node_id ,
3131
3127
hir:: Item {
3132
- id : new_id. node_id ,
3133
3128
hir_id : new_id. hir_id ,
3134
3129
ident,
3135
3130
attrs : attrs. clone ( ) ,
@@ -3235,7 +3230,6 @@ impl<'a> LoweringContext<'a> {
3235
3230
this. insert_item (
3236
3231
new_id,
3237
3232
hir:: Item {
3238
- id : new_id,
3239
3233
hir_id : new_hir_id,
3240
3234
ident,
3241
3235
attrs : attrs. clone ( ) ,
@@ -3369,7 +3363,7 @@ impl<'a> LoweringContext<'a> {
3369
3363
TraitItemKind :: Macro ( ..) => unimplemented ! ( ) ,
3370
3364
} ;
3371
3365
hir:: TraitItemRef {
3372
- id : hir:: TraitItemId { node_id : i. id } ,
3366
+ id : hir:: TraitItemId { hir_id : self . lower_node_id ( i. id ) . hir_id } ,
3373
3367
ident : i. ident ,
3374
3368
span : i. span ,
3375
3369
defaultness : self . lower_defaultness ( Defaultness :: Default , has_default) ,
@@ -3433,7 +3427,7 @@ impl<'a> LoweringContext<'a> {
3433
3427
3434
3428
fn lower_impl_item_ref ( & mut self , i : & ImplItem ) -> hir:: ImplItemRef {
3435
3429
hir:: ImplItemRef {
3436
- id : hir:: ImplItemId { node_id : i. id } ,
3430
+ id : hir:: ImplItemId { hir_id : self . lower_node_id ( i. id ) . hir_id } ,
3437
3431
ident : i. ident ,
3438
3432
span : i. span ,
3439
3433
vis : self . lower_visibility ( & i. vis , Some ( i. id ) ) ,
@@ -3535,10 +3529,9 @@ impl<'a> LoweringContext<'a> {
3535
3529
3536
3530
let node = self . lower_item_kind ( i. id , & mut ident, & attrs, & mut vis, & i. node ) ;
3537
3531
3538
- let LoweredNodeId { node_id, hir_id } = self . lower_node_id ( i. id ) ;
3532
+ let LoweredNodeId { node_id : _ , hir_id } = self . lower_node_id ( i. id ) ;
3539
3533
3540
3534
Some ( hir:: Item {
3541
- id : node_id,
3542
3535
hir_id,
3543
3536
ident,
3544
3537
attrs,
@@ -3552,7 +3545,6 @@ impl<'a> LoweringContext<'a> {
3552
3545
let LoweredNodeId { node_id, hir_id } = self . lower_node_id ( i. id ) ;
3553
3546
let def_id = self . resolver . definitions ( ) . local_def_id ( node_id) ;
3554
3547
hir:: ForeignItem {
3555
- id : node_id,
3556
3548
hir_id,
3557
3549
ident : i. ident ,
3558
3550
attrs : self . lower_attrs ( & i. attrs ) ,
@@ -3746,12 +3738,11 @@ impl<'a> LoweringContext<'a> {
3746
3738
let fs = fields
3747
3739
. iter ( )
3748
3740
. map ( |f| {
3749
- let LoweredNodeId { node_id, hir_id } = self . next_id ( ) ;
3741
+ let LoweredNodeId { node_id : _ , hir_id } = self . next_id ( ) ;
3750
3742
3751
3743
Spanned {
3752
3744
span : f. span ,
3753
3745
node : hir:: FieldPat {
3754
- id : node_id,
3755
3746
hir_id,
3756
3747
ident : f. node . ident ,
3757
3748
pat : self . lower_pat ( & f. node . pat ) ,
@@ -3783,9 +3774,8 @@ impl<'a> LoweringContext<'a> {
3783
3774
PatKind :: Mac ( _) => panic ! ( "Shouldn't exist here" ) ,
3784
3775
} ;
3785
3776
3786
- let LoweredNodeId { node_id, hir_id } = self . lower_node_id ( p. id ) ;
3777
+ let LoweredNodeId { node_id : _ , hir_id } = self . lower_node_id ( p. id ) ;
3787
3778
P ( hir:: Pat {
3788
- id : node_id,
3789
3779
hir_id,
3790
3780
node,
3791
3781
span : p. span ,
@@ -4359,7 +4349,7 @@ impl<'a> LoweringContext<'a> {
4359
4349
let iter = self . str_to_ident ( "iter" ) ;
4360
4350
4361
4351
let next_ident = self . str_to_ident ( "__next" ) ;
4362
- let next_pat = self . pat_ident_binding_mode (
4352
+ let ( next_pat, next_pat_nid ) = self . pat_ident_binding_mode (
4363
4353
desugared_span,
4364
4354
next_ident,
4365
4355
hir:: BindingAnnotation :: Mutable ,
@@ -4368,9 +4358,9 @@ impl<'a> LoweringContext<'a> {
4368
4358
// `::std::option::Option::Some(val) => next = val`
4369
4359
let pat_arm = {
4370
4360
let val_ident = self . str_to_ident ( "val" ) ;
4371
- let val_pat = self . pat_ident ( pat. span , val_ident) ;
4372
- let val_expr = P ( self . expr_ident ( pat. span , val_ident, val_pat . id ) ) ;
4373
- let next_expr = P ( self . expr_ident ( pat. span , next_ident, next_pat . id ) ) ;
4361
+ let ( val_pat, val_pat_nid ) = self . pat_ident ( pat. span , val_ident) ;
4362
+ let val_expr = P ( self . expr_ident ( pat. span , val_ident, val_pat_nid ) ) ;
4363
+ let next_expr = P ( self . expr_ident ( pat. span , next_ident, next_pat_nid ) ) ;
4374
4364
let assign = P ( self . expr (
4375
4365
pat. span ,
4376
4366
hir:: ExprKind :: Assign ( next_expr, val_expr) ,
@@ -4389,15 +4379,15 @@ impl<'a> LoweringContext<'a> {
4389
4379
} ;
4390
4380
4391
4381
// `mut iter`
4392
- let iter_pat = self . pat_ident_binding_mode (
4382
+ let ( iter_pat, iter_pat_nid ) = self . pat_ident_binding_mode (
4393
4383
desugared_span,
4394
4384
iter,
4395
4385
hir:: BindingAnnotation :: Mutable
4396
4386
) ;
4397
4387
4398
4388
// `match ::std::iter::Iterator::next(&mut iter) { ... }`
4399
4389
let match_expr = {
4400
- let iter = P ( self . expr_ident ( head_sp, iter, iter_pat . id ) ) ;
4390
+ let iter = P ( self . expr_ident ( head_sp, iter, iter_pat_nid ) ) ;
4401
4391
let ref_mut_iter = self . expr_mut_addr_of ( head_sp, iter) ;
4402
4392
let next_path = & [ "iter" , "Iterator" , "next" ] ;
4403
4393
let next_path = P ( self . expr_std_path ( head_sp, next_path, None , ThinVec :: new ( ) ) ) ;
@@ -4421,7 +4411,7 @@ impl<'a> LoweringContext<'a> {
4421
4411
span : head_sp,
4422
4412
} ;
4423
4413
4424
- let next_expr = P ( self . expr_ident ( head_sp, next_ident, next_pat . id ) ) ;
4414
+ let next_expr = P ( self . expr_ident ( head_sp, next_ident, next_pat_nid ) ) ;
4425
4415
4426
4416
// `let mut __next`
4427
4417
let next_let = self . stmt_let_pat (
@@ -4548,11 +4538,11 @@ impl<'a> LoweringContext<'a> {
4548
4538
// `Ok(val) => #[allow(unreachable_code)] val,`
4549
4539
let ok_arm = {
4550
4540
let val_ident = self . str_to_ident ( "val" ) ;
4551
- let val_pat = self . pat_ident ( e. span , val_ident) ;
4541
+ let ( val_pat, val_pat_nid ) = self . pat_ident ( e. span , val_ident) ;
4552
4542
let val_expr = P ( self . expr_ident_with_attrs (
4553
4543
e. span ,
4554
4544
val_ident,
4555
- val_pat . id ,
4545
+ val_pat_nid ,
4556
4546
ThinVec :: from ( attrs. clone ( ) ) ,
4557
4547
) ) ;
4558
4548
let ok_pat = self . pat_ok ( e. span , val_pat) ;
@@ -4564,12 +4554,12 @@ impl<'a> LoweringContext<'a> {
4564
4554
// return Try::from_error(From::from(err)),`
4565
4555
let err_arm = {
4566
4556
let err_ident = self . str_to_ident ( "err" ) ;
4567
- let err_local = self . pat_ident ( e. span , err_ident) ;
4557
+ let ( err_local, err_local_nid ) = self . pat_ident ( e. span , err_ident) ;
4568
4558
let from_expr = {
4569
4559
let path = & [ "convert" , "From" , "from" ] ;
4570
4560
let from = P ( self . expr_std_path (
4571
4561
e. span , path, None , ThinVec :: new ( ) ) ) ;
4572
- let err_expr = self . expr_ident ( e. span , err_ident, err_local . id ) ;
4562
+ let err_expr = self . expr_ident ( e. span , err_ident, err_local_nid ) ;
4573
4563
4574
4564
self . expr_call ( e. span , from, hir_vec ! [ err_expr] )
4575
4565
} ;
@@ -4917,15 +4907,15 @@ impl<'a> LoweringContext<'a> {
4917
4907
ident : Ident ,
4918
4908
ex : P < hir:: Expr > ,
4919
4909
) -> ( hir:: Stmt , NodeId ) {
4920
- let pat = if mutbl {
4910
+ let ( pat, pat_nid ) = if mutbl {
4921
4911
self . pat_ident_binding_mode ( sp, ident, hir:: BindingAnnotation :: Mutable )
4922
4912
} else {
4923
4913
self . pat_ident ( sp, ident)
4924
4914
} ;
4925
- let pat_id = pat . id ;
4915
+
4926
4916
(
4927
4917
self . stmt_let_pat ( sp, Some ( ex) , pat, hir:: LocalSource :: Normal ) ,
4928
- pat_id ,
4918
+ pat_nid ,
4929
4919
)
4930
4920
}
4931
4921
@@ -4983,7 +4973,7 @@ impl<'a> LoweringContext<'a> {
4983
4973
self . pat ( span, pt)
4984
4974
}
4985
4975
4986
- fn pat_ident ( & mut self , span : Span , ident : Ident ) -> P < hir:: Pat > {
4976
+ fn pat_ident ( & mut self , span : Span , ident : Ident ) -> ( P < hir:: Pat > , NodeId ) {
4987
4977
self . pat_ident_binding_mode ( span, ident, hir:: BindingAnnotation :: Unannotated )
4988
4978
}
4989
4979
@@ -4992,25 +4982,26 @@ impl<'a> LoweringContext<'a> {
4992
4982
span : Span ,
4993
4983
ident : Ident ,
4994
4984
bm : hir:: BindingAnnotation ,
4995
- ) -> P < hir:: Pat > {
4985
+ ) -> ( P < hir:: Pat > , NodeId ) {
4996
4986
let LoweredNodeId { node_id, hir_id } = self . next_id ( ) ;
4997
4987
4998
- P ( hir:: Pat {
4999
- id : node_id,
5000
- hir_id,
5001
- node : hir:: PatKind :: Binding ( bm, node_id, hir_id, ident. with_span_pos ( span) , None ) ,
5002
- span,
5003
- } )
4988
+ (
4989
+ P ( hir:: Pat {
4990
+ hir_id,
4991
+ node : hir:: PatKind :: Binding ( bm, node_id, hir_id, ident. with_span_pos ( span) , None ) ,
4992
+ span,
4993
+ } ) ,
4994
+ node_id
4995
+ )
5004
4996
}
5005
4997
5006
4998
fn pat_wild ( & mut self , span : Span ) -> P < hir:: Pat > {
5007
4999
self . pat ( span, hir:: PatKind :: Wild )
5008
5000
}
5009
5001
5010
5002
fn pat ( & mut self , span : Span , pat : hir:: PatKind ) -> P < hir:: Pat > {
5011
- let LoweredNodeId { node_id, hir_id } = self . next_id ( ) ;
5003
+ let LoweredNodeId { node_id : _ , hir_id } = self . next_id ( ) ;
5012
5004
P ( hir:: Pat {
5013
- id : node_id,
5014
5005
hir_id,
5015
5006
node : pat,
5016
5007
span,
0 commit comments