@@ -168,7 +168,7 @@ pub trait Resolver {
168168 span : Span ,
169169 crate_root : Option < & str > ,
170170 components : & [ & str ] ,
171- params : Option < P < hir:: PathParameters > >
171+ params : Option < P < hir:: GenericArgs > > ,
172172 is_value : bool ,
173173 ) -> hir:: Path ;
174174}
@@ -1176,7 +1176,8 @@ impl<'a> LoweringContext<'a> {
11761176 // Set the name to `impl Bound1 + Bound2`
11771177 let exist_ty_name = Symbol :: intern ( & pprust:: ty_to_string ( t) ) ;
11781178 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) )
11801181 }
11811182 ImplTraitContext :: Universal ( def_id) => {
11821183 let def_node_id = self . next_id ( ) . node_id ;
@@ -1245,7 +1246,7 @@ impl<'a> LoweringContext<'a> {
12451246 span : Span ,
12461247 fn_def_id : DefId ,
12471248 exist_ty_name : Name ,
1248- lower_bounds : impl FnOnce ( & mut LoweringContext ) -> hir:: TyParamBounds ,
1249+ lower_bounds : impl FnOnce ( & mut LoweringContext ) -> hir:: GenericBounds ,
12491250 ) -> hir:: Ty_ {
12501251 // We need to manually repeat the code of `next_id` because the lowering
12511252 // needs to happen while the owner_id is pointing to the item itself,
@@ -1970,15 +1971,15 @@ impl<'a> LoweringContext<'a> {
19701971 hir:: intravisit:: NestedVisitorMap :: None
19711972 }
19721973
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 ) {
19741975 // Don't collect elided lifetimes used inside of `Fn()` syntax.
19751976 if parameters. parenthesized {
19761977 let old_collect_elided_lifetimes = self . collect_elided_lifetimes ;
19771978 self . collect_elided_lifetimes = false ;
1978- hir:: intravisit:: walk_path_parameters ( self , span, parameters) ;
1979+ hir:: intravisit:: walk_generic_args ( self , span, parameters) ;
19791980 self . collect_elided_lifetimes = old_collect_elided_lifetimes;
19801981 } else {
1981- hir:: intravisit:: walk_path_parameters ( self , span, parameters) ;
1982+ hir:: intravisit:: walk_generic_args ( self , span, parameters) ;
19821983 }
19831984 }
19841985
@@ -2013,11 +2014,12 @@ impl<'a> LoweringContext<'a> {
20132014 }
20142015
20152016 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 {
20182019 // Introduce lifetimes one at a time so that we can handle
20192020 // 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) ;
20212023 }
20222024
20232025 hir:: intravisit:: walk_generic_param ( self , param) ;
@@ -2034,8 +2036,7 @@ impl<'a> LoweringContext<'a> {
20342036 return ;
20352037 }
20362038 }
2037- name @ hir:: LifetimeName :: Fresh ( _) => name,
2038- name @ hir:: LifetimeName :: Name ( _) => name,
2039+ hir:: LifetimeName :: Param ( _) => lifetime. name ,
20392040 hir:: LifetimeName :: Static => return ,
20402041 } ;
20412042
@@ -2117,9 +2118,8 @@ impl<'a> LoweringContext<'a> {
21172118 } ;
21182119
21192120 // "<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 ! [ ] ,
21232123 bindings : hir_vec ! [ hir:: TypeBinding {
21242124 name: Symbol :: intern( FN_OUTPUT_NAME ) ,
21252125 ty: output_ty,
@@ -2129,13 +2129,11 @@ impl<'a> LoweringContext<'a> {
21292129 parenthesized : false ,
21302130 } ) ;
21312131
2132- let let future_path =
2132+ let future_path =
21332133 this. std_path ( span, & [ "future" , "Future" ] , Some ( future_params) , false ) ;
21342134
2135- // FIXME(cramertj) collect input lifetimes to function and add them to
2136- // the output `impl Trait` type here.
21372135 let mut bounds = vec ! [
2138- hir:: TyParamBound :: TraitTyParamBound (
2136+ hir:: GenericBound :: Trait (
21392137 hir:: PolyTraitRef {
21402138 trait_ref: hir:: TraitRef {
21412139 path: future_path,
@@ -2149,7 +2147,7 @@ impl<'a> LoweringContext<'a> {
21492147 ] ;
21502148
21512149 if let Some ( ( name, span) ) = bound_lifetime {
2152- bounds. push ( hir:: RegionTyParamBound (
2150+ bounds. push ( hir:: GenericBound :: Outlives (
21532151 hir:: Lifetime { id : this. next_id ( ) . node_id , name, span } ) ) ;
21542152 }
21552153
@@ -4366,7 +4364,7 @@ impl<'a> LoweringContext<'a> {
43664364 & mut self ,
43674365 span : Span ,
43684366 components : & [ & str ] ,
4369- params : Option < P < hir:: PathParameters > > ,
4367+ params : Option < P < hir:: GenericArgs > > ,
43704368 attrs : ThinVec < Attribute > ,
43714369 ) -> hir:: Expr {
43724370 let path = self . std_path ( span, components, params, true ) ;
@@ -4545,7 +4543,7 @@ impl<'a> LoweringContext<'a> {
45454543 & mut self ,
45464544 span : Span ,
45474545 components : & [ & str ] ,
4548- params : Option < P < hir:: PathParameters > > ,
4546+ params : Option < P < hir:: GenericArgs > > ,
45494547 is_value : bool
45504548 ) -> hir:: Path {
45514549 self . resolver
0 commit comments