@@ -676,15 +676,15 @@ impl<'a> LoweringContext<'a> {
676
676
// that collisions are ok here and this shouldn't
677
677
// really show up for end-user.
678
678
let str_name = match hir_name {
679
- ParamName :: Plain ( ident) => name . as_interned_str ( ) ,
679
+ ParamName :: Plain ( ident) => ident . as_interned_str ( ) ,
680
680
ParamName :: Fresh ( _) => keywords:: UnderscoreLifetime . name ( ) . as_interned_str ( ) ,
681
681
} ;
682
682
683
683
// Add a definition for the in-band lifetime def
684
684
self . resolver . definitions ( ) . create_def_with_parent (
685
685
parent_id. index ,
686
686
def_node_id,
687
- DefPathData :: LifetimeDef ( str_name) ,
687
+ DefPathData :: LifetimeParam ( str_name) ,
688
688
DefIndexAddressSpace :: High ,
689
689
Mark :: root ( ) ,
690
690
span,
@@ -719,10 +719,10 @@ impl<'a> LoweringContext<'a> {
719
719
return ;
720
720
}
721
721
722
- let hir_name = ParamName :: Plain ( name ) ;
722
+ let hir_name = ParamName :: Plain ( ident ) ;
723
723
724
724
if self . lifetimes_to_define . iter ( )
725
- . any ( |( _, lt_name) | * lt_name. modern ( ) == hir_name. modern ( ) ) {
725
+ . any ( |( _, lt_name) | lt_name. modern ( ) == hir_name. modern ( ) ) {
726
726
return ;
727
727
}
728
728
@@ -1185,10 +1185,11 @@ impl<'a> LoweringContext<'a> {
1185
1185
let ident = Ident :: from_str ( & pprust:: ty_to_string ( t) ) . with_span_pos ( span) ;
1186
1186
self . in_band_ty_params . push ( hir:: GenericParam {
1187
1187
id : def_node_id,
1188
- ident : ParamName :: Plain ( ident) ,
1188
+ name : ParamName :: Plain ( ident) ,
1189
1189
pure_wrt_drop : false ,
1190
1190
attrs : hir_vec ! [ ] ,
1191
1191
bounds : hir_bounds,
1192
+ span,
1192
1193
kind : hir:: GenericParamKind :: Type {
1193
1194
default : None ,
1194
1195
synthetic : Some ( hir:: SyntheticTyParamKind :: ImplTrait ) ,
@@ -1438,7 +1439,7 @@ impl<'a> LoweringContext<'a> {
1438
1439
1439
1440
let name = match name {
1440
1441
hir:: LifetimeName :: Underscore => {
1441
- hir:: ParamName :: Plain ( keywords:: UnderscoreLifetime . name ( ) )
1442
+ hir:: ParamName :: Plain ( keywords:: UnderscoreLifetime . ident ( ) )
1442
1443
}
1443
1444
hir:: LifetimeName :: Param ( param_name) => param_name,
1444
1445
_ => bug ! ( "expected LifetimeName::Param or ParamName::Plain" ) ,
@@ -2101,7 +2102,7 @@ impl<'a> LoweringContext<'a> {
2101
2102
let future_params = P ( hir:: GenericArgs {
2102
2103
args : hir_vec ! [ ] ,
2103
2104
bindings : hir_vec ! [ hir:: TypeBinding {
2104
- name : Symbol :: intern ( FN_OUTPUT_NAME ) ,
2105
+ ident : Ident :: from_str ( FN_OUTPUT_NAME ) ,
2105
2106
ty: output_ty,
2106
2107
id: this. next_id( ) . node_id,
2107
2108
span,
@@ -2163,7 +2164,7 @@ impl<'a> LoweringContext<'a> {
2163
2164
2164
2165
fn lower_lifetime ( & mut self , l : & Lifetime ) -> hir:: Lifetime {
2165
2166
let span = l. ident . span ;
2166
- match self . lower_ident ( l. ident ) {
2167
+ match l. ident {
2167
2168
ident if ident. name == keywords:: StaticLifetime . name ( ) =>
2168
2169
self . new_named_lifetime ( l. id , span, hir:: LifetimeName :: Static ) ,
2169
2170
ident if ident. name == keywords:: UnderscoreLifetime . name ( ) =>
@@ -2221,7 +2222,7 @@ impl<'a> LoweringContext<'a> {
2221
2222
let lt = self . lower_lifetime ( & Lifetime { id : param. id , ident : param. ident } ) ;
2222
2223
let param_name = match lt. name {
2223
2224
hir:: LifetimeName :: Param ( param_name) => param_name,
2224
- _ => hir:: ParamName :: Plain ( lt. name . name ( ) ) ,
2225
+ _ => hir:: ParamName :: Plain ( lt. name . ident ( ) ) ,
2225
2226
} ;
2226
2227
let param = hir:: GenericParam {
2227
2228
id : lt. id ,
@@ -2238,14 +2239,14 @@ impl<'a> LoweringContext<'a> {
2238
2239
param
2239
2240
}
2240
2241
GenericParamKind :: Type { ref default, .. } => {
2241
- let mut name = self . lower_ident ( param. ident ) ;
2242
-
2243
2242
// Don't expose `Self` (recovered "keyword used as ident" parse error).
2244
2243
// `rustc::ty` expects `Self` to be only used for a trait's `Self`.
2245
2244
// Instead, use gensym("Self") to create a distinct name that looks the same.
2246
- if name == keywords:: SelfType . name ( ) {
2247
- name = Symbol :: gensym ( "Self" ) ;
2248
- }
2245
+ let ident = if param. ident . name == keywords:: SelfType . name ( ) {
2246
+ param. ident . gensym ( )
2247
+ } else {
2248
+ param. ident
2249
+ } ;
2249
2250
2250
2251
let add_bounds = add_bounds. get ( & param. id ) . map_or ( & [ ] [ ..] , |x| & x) ;
2251
2252
if !add_bounds. is_empty ( ) {
@@ -2256,11 +2257,11 @@ impl<'a> LoweringContext<'a> {
2256
2257
2257
2258
hir:: GenericParam {
2258
2259
id : self . lower_node_id ( param. id ) . node_id ,
2259
- name : hir:: ParamName :: Plain ( name) ,
2260
- span : param. ident . span ,
2260
+ name : hir:: ParamName :: Plain ( ident) ,
2261
2261
pure_wrt_drop : attr:: contains_name ( & param. attrs , "may_dangle" ) ,
2262
2262
attrs : self . lower_attrs ( & param. attrs ) ,
2263
2263
bounds,
2264
+ span : ident. span ,
2264
2265
kind : hir:: GenericParamKind :: Type {
2265
2266
default : default. as_ref ( ) . map ( |x| {
2266
2267
self . lower_ty ( x, ImplTraitContext :: Disallowed )
@@ -3656,7 +3657,7 @@ impl<'a> LoweringContext<'a> {
3656
3657
let e2 = self . lower_expr ( e2) ;
3657
3658
let ty_path = P ( self . std_path ( span, & [ "ops" , "RangeInclusive" ] , None , false ) ) ;
3658
3659
let ty = P ( self . ty_path ( id, span, hir:: QPath :: Resolved ( None , ty_path) ) ) ;
3659
- let new_seg = P ( hir:: PathSegment :: from_name ( Ident :: from_str ( "new" ) ) ) ;
3660
+ let new_seg = P ( hir:: PathSegment :: from_ident ( Ident :: from_str ( "new" ) ) ) ;
3660
3661
let new_path = hir:: QPath :: TypeRelative ( ty, new_seg) ;
3661
3662
let new = P ( self . expr ( span, hir:: ExprPath ( new_path) , ThinVec :: new ( ) ) ) ;
3662
3663
hir:: ExprCall ( new, hir_vec ! [ e1, e2] )
0 commit comments