@@ -701,9 +701,9 @@ impl<'a> LoweringContext<'a> {
701
701
id : def_node_id,
702
702
span,
703
703
pure_wrt_drop : false ,
704
+ bounds : vec ! [ ] . into ( ) ,
704
705
kind : hir:: GenericParamKind :: Lifetime {
705
706
name : hir_name,
706
- bounds : vec ! [ ] . into ( ) ,
707
707
in_band : true ,
708
708
lifetime : hir:: Lifetime {
709
709
id : def_node_id,
@@ -1127,7 +1127,7 @@ impl<'a> LoweringContext<'a> {
1127
1127
Some ( self . lower_poly_trait_ref ( ty, itctx) )
1128
1128
}
1129
1129
TraitTyParamBound ( _, TraitBoundModifier :: Maybe ) => None ,
1130
- RegionTyParamBound ( ref lifetime) => {
1130
+ Outlives ( ref lifetime) => {
1131
1131
if lifetime_bound. is_none ( ) {
1132
1132
lifetime_bound = Some ( self . lower_lifetime ( lifetime) ) ;
1133
1133
}
@@ -1246,16 +1246,16 @@ impl<'a> LoweringContext<'a> {
1246
1246
span,
1247
1247
) ;
1248
1248
1249
- let hir_bounds = self . lower_bounds ( bounds, itctx) ;
1249
+ let hir_bounds = self . lower_param_bounds ( bounds, itctx) ;
1250
1250
// Set the name to `impl Bound1 + Bound2`
1251
1251
let name = Symbol :: intern ( & pprust:: ty_to_string ( t) ) ;
1252
1252
self . in_band_ty_params . push ( hir:: GenericParam {
1253
1253
id : def_node_id,
1254
1254
span,
1255
1255
pure_wrt_drop : false ,
1256
+ bounds : hir_bounds,
1256
1257
kind : hir:: GenericParamKind :: Type {
1257
1258
name,
1258
- bounds : hir_bounds,
1259
1259
default : None ,
1260
1260
synthetic : Some ( hir:: SyntheticTyParamKind :: ImplTrait ) ,
1261
1261
attrs : P :: new ( ) ,
@@ -1299,7 +1299,7 @@ impl<'a> LoweringContext<'a> {
1299
1299
& mut self ,
1300
1300
exist_ty_id : NodeId ,
1301
1301
parent_index : DefIndex ,
1302
- bounds : & hir:: TyParamBounds ,
1302
+ bounds : & hir:: ParamBounds ,
1303
1303
) -> ( HirVec < hir:: Lifetime > , HirVec < hir:: GenericParam > ) {
1304
1304
// This visitor walks over impl trait bounds and creates defs for all lifetimes which
1305
1305
// appear in the bounds, excluding lifetimes that are created within the bounds.
@@ -1420,9 +1420,9 @@ impl<'a> LoweringContext<'a> {
1420
1420
id : def_node_id,
1421
1421
span : lifetime. span ,
1422
1422
pure_wrt_drop : false ,
1423
+ bounds : vec ! [ ] . into ( ) ,
1423
1424
kind : hir:: GenericParamKind :: Lifetime {
1424
1425
name,
1425
- bounds : vec ! [ ] . into ( ) ,
1426
1426
in_band : false ,
1427
1427
lifetime : hir:: Lifetime {
1428
1428
id : def_node_id,
@@ -1882,18 +1882,18 @@ impl<'a> LoweringContext<'a> {
1882
1882
} )
1883
1883
}
1884
1884
1885
- fn lower_ty_param_bound (
1885
+ fn lower_param_bound (
1886
1886
& mut self ,
1887
- tpb : & TyParamBound ,
1887
+ tpb : & ParamBound ,
1888
1888
itctx : ImplTraitContext ,
1889
- ) -> hir:: TyParamBound {
1889
+ ) -> hir:: ParamBound {
1890
1890
match * tpb {
1891
1891
TraitTyParamBound ( ref ty, modifier) => hir:: TraitTyParamBound (
1892
1892
self . lower_poly_trait_ref ( ty, itctx) ,
1893
1893
self . lower_trait_bound_modifier ( modifier) ,
1894
1894
) ,
1895
- RegionTyParamBound ( ref lifetime) => {
1896
- hir:: RegionTyParamBound ( self . lower_lifetime ( lifetime) )
1895
+ Outlives ( ref lifetime) => {
1896
+ hir:: Outlives ( self . lower_lifetime ( lifetime) )
1897
1897
}
1898
1898
}
1899
1899
}
@@ -1935,19 +1935,20 @@ impl<'a> LoweringContext<'a> {
1935
1935
fn lower_generic_params (
1936
1936
& mut self ,
1937
1937
params : & Vec < GenericParam > ,
1938
- add_bounds : & NodeMap < Vec < TyParamBound > > ,
1938
+ add_bounds : & NodeMap < Vec < ParamBound > > ,
1939
1939
itctx : ImplTraitContext ,
1940
1940
) -> hir:: HirVec < hir:: GenericParam > {
1941
1941
params. iter ( ) . map ( |param| self . lower_generic_param ( param, add_bounds, itctx) ) . collect ( )
1942
1942
}
1943
1943
1944
1944
fn lower_generic_param ( & mut self ,
1945
1945
param : & GenericParam ,
1946
- add_bounds : & NodeMap < Vec < TyParamBound > > ,
1946
+ add_bounds : & NodeMap < Vec < ParamBound > > ,
1947
1947
itctx : ImplTraitContext )
1948
1948
-> hir:: GenericParam {
1949
+ let mut bounds = self . lower_param_bounds ( & param. bounds , itctx) ;
1949
1950
match param. kind {
1950
- GenericParamKind :: Lifetime { ref bounds , ref lifetime } => {
1951
+ GenericParamKind :: Lifetime { ref lifetime } => {
1951
1952
let was_collecting_in_band = self . is_collecting_in_band_lifetimes ;
1952
1953
self . is_collecting_in_band_lifetimes = false ;
1953
1954
@@ -1956,9 +1957,9 @@ impl<'a> LoweringContext<'a> {
1956
1957
id : lifetime. id ,
1957
1958
span : lifetime. span ,
1958
1959
pure_wrt_drop : attr:: contains_name ( & param. attrs , "may_dangle" ) ,
1960
+ bounds,
1959
1961
kind : hir:: GenericParamKind :: Lifetime {
1960
1962
name : lifetime. name ,
1961
- bounds : bounds. iter ( ) . map ( |lt| self . lower_lifetime ( lt) ) . collect ( ) ,
1962
1963
in_band : false ,
1963
1964
lifetime,
1964
1965
}
@@ -1968,7 +1969,7 @@ impl<'a> LoweringContext<'a> {
1968
1969
1969
1970
param
1970
1971
}
1971
- GenericParamKind :: Type { ref bounds , ref default } => {
1972
+ GenericParamKind :: Type { ref default , .. } => {
1972
1973
let mut name = self . lower_ident ( param. ident ) ;
1973
1974
1974
1975
// Don't expose `Self` (recovered "keyword used as ident" parse error).
@@ -1978,21 +1979,20 @@ impl<'a> LoweringContext<'a> {
1978
1979
name = Symbol :: gensym ( "Self" ) ;
1979
1980
}
1980
1981
1981
- let mut bounds = self . lower_bounds ( bounds, itctx) ;
1982
1982
let add_bounds = add_bounds. get ( & param. id ) . map_or ( & [ ] [ ..] , |x| & x) ;
1983
1983
if !add_bounds. is_empty ( ) {
1984
1984
bounds = bounds. into_iter ( )
1985
- . chain ( self . lower_bounds ( add_bounds, itctx) . into_iter ( ) )
1985
+ . chain ( self . lower_param_bounds ( add_bounds, itctx) . into_iter ( ) )
1986
1986
. collect ( ) ;
1987
1987
}
1988
1988
1989
1989
hir:: GenericParam {
1990
1990
id : self . lower_node_id ( param. id ) . node_id ,
1991
1991
span : param. ident . span ,
1992
1992
pure_wrt_drop : attr:: contains_name ( & param. attrs , "may_dangle" ) ,
1993
+ bounds,
1993
1994
kind : hir:: GenericParamKind :: Type {
1994
1995
name,
1995
- bounds,
1996
1996
default : default. as_ref ( ) . map ( |x| {
1997
1997
self . lower_ty ( x, ImplTraitContext :: Disallowed )
1998
1998
} ) ,
@@ -2107,7 +2107,7 @@ impl<'a> LoweringContext<'a> {
2107
2107
// Ignore `?Trait` bounds.
2108
2108
// Tthey were copied into type parameters already.
2109
2109
TraitTyParamBound ( _, TraitBoundModifier :: Maybe ) => None ,
2110
- _ => Some ( this. lower_ty_param_bound (
2110
+ _ => Some ( this. lower_param_bound (
2111
2111
bound,
2112
2112
ImplTraitContext :: Disallowed ,
2113
2113
) ) ,
@@ -2228,15 +2228,9 @@ impl<'a> LoweringContext<'a> {
2228
2228
}
2229
2229
}
2230
2230
2231
- fn lower_bounds (
2232
- & mut self ,
2233
- bounds : & [ TyParamBound ] ,
2234
- itctx : ImplTraitContext ,
2235
- ) -> hir:: TyParamBounds {
2236
- bounds
2237
- . iter ( )
2238
- . map ( |bound| self . lower_ty_param_bound ( bound, itctx) )
2239
- . collect ( )
2231
+ fn lower_param_bounds ( & mut self , bounds : & [ ParamBound ] , itctx : ImplTraitContext )
2232
+ -> hir:: ParamBounds {
2233
+ bounds. iter ( ) . map ( |bound| self . lower_param_bound ( bound, itctx) ) . collect ( )
2240
2234
}
2241
2235
2242
2236
fn lower_block ( & mut self , b : & Block , targeted_by_break : bool ) -> P < hir:: Block > {
@@ -2422,7 +2416,7 @@ impl<'a> LoweringContext<'a> {
2422
2416
)
2423
2417
}
2424
2418
ItemKind :: Trait ( is_auto, unsafety, ref generics, ref bounds, ref items) => {
2425
- let bounds = self . lower_bounds ( bounds, ImplTraitContext :: Disallowed ) ;
2419
+ let bounds = self . lower_param_bounds ( bounds, ImplTraitContext :: Disallowed ) ;
2426
2420
let items = items
2427
2421
. iter ( )
2428
2422
. map ( |item| self . lower_trait_item_ref ( item) )
@@ -2437,7 +2431,7 @@ impl<'a> LoweringContext<'a> {
2437
2431
}
2438
2432
ItemKind :: TraitAlias ( ref generics, ref bounds) => hir:: ItemTraitAlias (
2439
2433
self . lower_generics ( generics, ImplTraitContext :: Disallowed ) ,
2440
- self . lower_bounds ( bounds, ImplTraitContext :: Disallowed ) ,
2434
+ self . lower_param_bounds ( bounds, ImplTraitContext :: Disallowed ) ,
2441
2435
) ,
2442
2436
ItemKind :: MacroDef ( ..) | ItemKind :: Mac ( ..) => panic ! ( "Shouldn't still be around" ) ,
2443
2437
}
@@ -2664,7 +2658,7 @@ impl<'a> LoweringContext<'a> {
2664
2658
TraitItemKind :: Type ( ref bounds, ref default) => (
2665
2659
self . lower_generics ( & i. generics , ImplTraitContext :: Disallowed ) ,
2666
2660
hir:: TraitItemKind :: Type (
2667
- self . lower_bounds ( bounds, ImplTraitContext :: Disallowed ) ,
2661
+ self . lower_param_bounds ( bounds, ImplTraitContext :: Disallowed ) ,
2668
2662
default
2669
2663
. as_ref ( )
2670
2664
. map ( |x| self . lower_ty ( x, ImplTraitContext :: Disallowed ) ) ,
0 commit comments