@@ -121,7 +121,8 @@ pub struct LoweringContext<'a> {
121
121
// (i.e. it doesn't appear in the in_scope_lifetimes list), it is added
122
122
// to this list. The results of this list are then added to the list of
123
123
// lifetime definitions in the corresponding impl or function generics.
124
- lifetimes_to_define : Vec < ( Span , Name ) > ,
124
+ lifetimes_to_define : Vec < ( Span , hir:: LifetimeName ) > ,
125
+
125
126
// Whether or not in-band lifetimes are being collected. This is used to
126
127
// indicate whether or not we're in a place where new lifetimes will result
127
128
// in in-band lifetime definitions, such a function or an impl header.
@@ -566,14 +567,23 @@ impl<'a> LoweringContext<'a> {
566
567
567
568
let params = lifetimes_to_define
568
569
. into_iter ( )
569
- . map ( |( span, name ) | {
570
+ . map ( |( span, hir_name ) | {
570
571
let def_node_id = self . next_id ( ) . node_id ;
571
572
573
+ let str_name = match hir_name {
574
+ hir:: LifetimeName :: Name ( n) => n. as_str ( ) ,
575
+ hir:: LifetimeName :: Implicit
576
+ | hir:: LifetimeName :: Underscore
577
+ | hir:: LifetimeName :: Static => {
578
+ span_bug ! ( span, "unexpected in-band lifetime name: {:?}" , hir_name)
579
+ }
580
+ } ;
581
+
572
582
// Add a definition for the in-band lifetime def
573
583
self . resolver . definitions ( ) . create_def_with_parent (
574
584
parent_id. index ,
575
585
def_node_id,
576
- DefPathData :: LifetimeDef ( name . as_str ( ) ) ,
586
+ DefPathData :: LifetimeDef ( str_name ) ,
577
587
DefIndexAddressSpace :: High ,
578
588
Mark :: root ( ) ,
579
589
span,
@@ -583,7 +593,7 @@ impl<'a> LoweringContext<'a> {
583
593
lifetime : hir:: Lifetime {
584
594
id : def_node_id,
585
595
span,
586
- name : hir :: LifetimeName :: Name ( name ) ,
596
+ name : hir_name ,
587
597
} ,
588
598
bounds : Vec :: new ( ) . into ( ) ,
589
599
pure_wrt_drop : false ,
@@ -613,14 +623,16 @@ impl<'a> LoweringContext<'a> {
613
623
return ;
614
624
}
615
625
626
+ let hir_name = hir:: LifetimeName :: Name ( name) ;
627
+
616
628
if self . lifetimes_to_define
617
629
. iter ( )
618
- . any ( |( _, lt_name) | * lt_name == name )
630
+ . any ( |( _, lt_name) | * lt_name == hir_name )
619
631
{
620
632
return ;
621
633
}
622
634
623
- self . lifetimes_to_define . push ( ( span, name ) ) ;
635
+ self . lifetimes_to_define . push ( ( span, hir_name ) ) ;
624
636
}
625
637
626
638
// Evaluates `f` with the lifetimes in `lt_defs` in-scope.
0 commit comments