@@ -168,7 +168,7 @@ pub trait Resolver {
168
168
span : Span ,
169
169
crate_root : Option < & str > ,
170
170
components : & [ & str ] ,
171
- params : Option < P < hir:: PathParameters > >
171
+ params : Option < P < hir:: GenericArgs > > ,
172
172
is_value : bool ,
173
173
) -> hir:: Path ;
174
174
}
@@ -1176,7 +1176,8 @@ impl<'a> LoweringContext<'a> {
1176
1176
// Set the name to `impl Bound1 + Bound2`
1177
1177
let exist_ty_name = Symbol :: intern ( & pprust:: ty_to_string ( t) ) ;
1178
1178
self . lower_existential_impl_trait (
1179
- span, fn_def_id, exist_ty_name, |this| this. lower_bounds ( bounds, itctx) )
1179
+ span, fn_def_id, exist_ty_name,
1180
+ |this| this. lower_param_bounds ( bounds, itctx) )
1180
1181
}
1181
1182
ImplTraitContext :: Universal ( def_id) => {
1182
1183
let def_node_id = self . next_id ( ) . node_id ;
@@ -1245,7 +1246,7 @@ impl<'a> LoweringContext<'a> {
1245
1246
span : Span ,
1246
1247
fn_def_id : DefId ,
1247
1248
exist_ty_name : Name ,
1248
- lower_bounds : impl FnOnce ( & mut LoweringContext ) -> hir:: TyParamBounds ,
1249
+ lower_bounds : impl FnOnce ( & mut LoweringContext ) -> hir:: GenericBounds ,
1249
1250
) -> hir:: Ty_ {
1250
1251
// We need to manually repeat the code of `next_id` because the lowering
1251
1252
// needs to happen while the owner_id is pointing to the item itself,
@@ -1970,15 +1971,15 @@ impl<'a> LoweringContext<'a> {
1970
1971
hir:: intravisit:: NestedVisitorMap :: None
1971
1972
}
1972
1973
1973
- fn visit_path_parameters ( & mut self , span : Span , parameters : & ' v hir:: PathParameters ) {
1974
+ fn visit_generic_args ( & mut self , span : Span , parameters : & ' v hir:: GenericArgs ) {
1974
1975
// Don't collect elided lifetimes used inside of `Fn()` syntax.
1975
1976
if parameters. parenthesized {
1976
1977
let old_collect_elided_lifetimes = self . collect_elided_lifetimes ;
1977
1978
self . collect_elided_lifetimes = false ;
1978
- hir:: intravisit:: walk_path_parameters ( self , span, parameters) ;
1979
+ hir:: intravisit:: walk_generic_args ( self , span, parameters) ;
1979
1980
self . collect_elided_lifetimes = old_collect_elided_lifetimes;
1980
1981
} else {
1981
- hir:: intravisit:: walk_path_parameters ( self , span, parameters) ;
1982
+ hir:: intravisit:: walk_generic_args ( self , span, parameters) ;
1982
1983
}
1983
1984
}
1984
1985
@@ -2013,11 +2014,12 @@ impl<'a> LoweringContext<'a> {
2013
2014
}
2014
2015
2015
2016
fn visit_generic_param ( & mut self , param : & ' v hir:: GenericParam ) {
2016
- // Record the introduction of 'a in `for<'a> ...`
2017
- if let hir:: GenericParam :: Lifetime ( ref lt_def ) = * param {
2017
+ // Record the introduction of 'a in `for<'a> ...`
2018
+ if let hir:: GenericParamKind :: Lifetime { .. } = param. kind {
2018
2019
// Introduce lifetimes one at a time so that we can handle
2019
2020
// cases like `fn foo<'d>() -> impl for<'a, 'b: 'a, 'c: 'b + 'd>`
2020
- self . currently_bound_lifetimes . push ( lt_def. lifetime . name ) ;
2021
+ let lt_name = hir:: LifetimeName :: Param ( param. name ) ;
2022
+ self . currently_bound_lifetimes . push ( lt_name) ;
2021
2023
}
2022
2024
2023
2025
hir:: intravisit:: walk_generic_param ( self , param) ;
@@ -2034,8 +2036,7 @@ impl<'a> LoweringContext<'a> {
2034
2036
return ;
2035
2037
}
2036
2038
}
2037
- name @ hir:: LifetimeName :: Fresh ( _) => name,
2038
- name @ hir:: LifetimeName :: Name ( _) => name,
2039
+ hir:: LifetimeName :: Param ( _) => lifetime. name ,
2039
2040
hir:: LifetimeName :: Static => return ,
2040
2041
} ;
2041
2042
@@ -2117,9 +2118,8 @@ impl<'a> LoweringContext<'a> {
2117
2118
} ;
2118
2119
2119
2120
// "<Output = T>"
2120
- let future_params = P ( hir:: PathParameters {
2121
- lifetimes : hir_vec ! [ ] ,
2122
- types : hir_vec ! [ ] ,
2121
+ let future_params = P ( hir:: GenericArgs {
2122
+ args : hir_vec ! [ ] ,
2123
2123
bindings : hir_vec ! [ hir:: TypeBinding {
2124
2124
name: Symbol :: intern( FN_OUTPUT_NAME ) ,
2125
2125
ty: output_ty,
@@ -2129,13 +2129,11 @@ impl<'a> LoweringContext<'a> {
2129
2129
parenthesized : false ,
2130
2130
} ) ;
2131
2131
2132
- let let future_path =
2132
+ let future_path =
2133
2133
this. std_path ( span, & [ "future" , "Future" ] , Some ( future_params) , false ) ;
2134
2134
2135
- // FIXME(cramertj) collect input lifetimes to function and add them to
2136
- // the output `impl Trait` type here.
2137
2135
let mut bounds = vec ! [
2138
- hir:: TyParamBound :: TraitTyParamBound (
2136
+ hir:: GenericBound :: Trait (
2139
2137
hir:: PolyTraitRef {
2140
2138
trait_ref: hir:: TraitRef {
2141
2139
path: future_path,
@@ -2149,7 +2147,7 @@ impl<'a> LoweringContext<'a> {
2149
2147
] ;
2150
2148
2151
2149
if let Some ( ( name, span) ) = bound_lifetime {
2152
- bounds. push ( hir:: RegionTyParamBound (
2150
+ bounds. push ( hir:: GenericBound :: Outlives (
2153
2151
hir:: Lifetime { id : this. next_id ( ) . node_id , name, span } ) ) ;
2154
2152
}
2155
2153
@@ -4366,7 +4364,7 @@ impl<'a> LoweringContext<'a> {
4366
4364
& mut self ,
4367
4365
span : Span ,
4368
4366
components : & [ & str ] ,
4369
- params : Option < P < hir:: PathParameters > > ,
4367
+ params : Option < P < hir:: GenericArgs > > ,
4370
4368
attrs : ThinVec < Attribute > ,
4371
4369
) -> hir:: Expr {
4372
4370
let path = self . std_path ( span, components, params, true ) ;
@@ -4545,7 +4543,7 @@ impl<'a> LoweringContext<'a> {
4545
4543
& mut self ,
4546
4544
span : Span ,
4547
4545
components : & [ & str ] ,
4548
- params : Option < P < hir:: PathParameters > > ,
4546
+ params : Option < P < hir:: GenericArgs > > ,
4549
4547
is_value : bool
4550
4548
) -> hir:: Path {
4551
4549
self . resolver
0 commit comments