@@ -720,7 +720,7 @@ impl LoweringContext<'_> {
720720 (
721721 // Disallow impl Trait in foreign items
722722 this. lower_fn_decl ( fdec, None , false , None ) ,
723- this. lower_fn_args_to_names ( fdec) ,
723+ this. lower_fn_params_to_names ( fdec) ,
724724 )
725725 } ,
726726 ) ;
@@ -827,7 +827,7 @@ impl LoweringContext<'_> {
827827 ) ,
828828 ) ,
829829 TraitItemKind :: Method ( ref sig, None ) => {
830- let names = self . lower_fn_args_to_names ( & sig. decl ) ;
830+ let names = self . lower_fn_params_to_names ( & sig. decl ) ;
831831 let ( generics, sig) = self . lower_method_sig (
832832 & i. generics ,
833833 sig,
@@ -1028,10 +1028,10 @@ impl LoweringContext<'_> {
10281028 }
10291029 }
10301030
1031- fn record_body ( & mut self , arguments : HirVec < hir:: Arg > , value : hir:: Expr ) -> hir:: BodyId {
1031+ fn record_body ( & mut self , params : HirVec < hir:: Param > , value : hir:: Expr ) -> hir:: BodyId {
10321032 let body = hir:: Body {
10331033 generator_kind : self . generator_kind ,
1034- arguments ,
1034+ params ,
10351035 value,
10361036 } ;
10371037 let id = body. id ( ) ;
@@ -1041,21 +1041,21 @@ impl LoweringContext<'_> {
10411041
10421042 fn lower_body (
10431043 & mut self ,
1044- f : impl FnOnce ( & mut LoweringContext < ' _ > ) -> ( HirVec < hir:: Arg > , hir:: Expr ) ,
1044+ f : impl FnOnce ( & mut LoweringContext < ' _ > ) -> ( HirVec < hir:: Param > , hir:: Expr ) ,
10451045 ) -> hir:: BodyId {
10461046 let prev_gen_kind = self . generator_kind . take ( ) ;
1047- let ( arguments , result) = f ( self ) ;
1048- let body_id = self . record_body ( arguments , result) ;
1047+ let ( parameters , result) = f ( self ) ;
1048+ let body_id = self . record_body ( parameters , result) ;
10491049 self . generator_kind = prev_gen_kind;
10501050 body_id
10511051 }
10521052
1053- fn lower_arg ( & mut self , arg : & Arg ) -> hir:: Arg {
1054- hir:: Arg {
1055- attrs : self . lower_attrs ( & arg . attrs ) ,
1056- hir_id : self . lower_node_id ( arg . id ) ,
1057- pat : self . lower_pat ( & arg . pat ) ,
1058- span : arg . span ,
1053+ fn lower_param ( & mut self , param : & Param ) -> hir:: Param {
1054+ hir:: Param {
1055+ attrs : self . lower_attrs ( & param . attrs ) ,
1056+ hir_id : self . lower_node_id ( param . id ) ,
1057+ pat : self . lower_pat ( & param . pat ) ,
1058+ span : param . span ,
10591059 }
10601060 }
10611061
@@ -1065,7 +1065,7 @@ impl LoweringContext<'_> {
10651065 body : impl FnOnce ( & mut LoweringContext < ' _ > ) -> hir:: Expr ,
10661066 ) -> hir:: BodyId {
10671067 self . lower_body ( |this| (
1068- decl. inputs . iter ( ) . map ( |x| this. lower_arg ( x) ) . collect ( ) ,
1068+ decl. inputs . iter ( ) . map ( |x| this. lower_param ( x) ) . collect ( ) ,
10691069 body ( this) ,
10701070 ) )
10711071 }
@@ -1093,10 +1093,10 @@ impl LoweringContext<'_> {
10931093 } ;
10941094
10951095 self . lower_body ( |this| {
1096- let mut arguments : Vec < hir:: Arg > = Vec :: new ( ) ;
1096+ let mut parameters : Vec < hir:: Param > = Vec :: new ( ) ;
10971097 let mut statements: Vec < hir:: Stmt > = Vec :: new ( ) ;
10981098
1099- // Async function arguments are lowered into the closure body so that they are
1099+ // Async function parameters are lowered into the closure body so that they are
11001100 // captured and so that the drop order matches the equivalent non-async functions.
11011101 //
11021102 // from:
@@ -1121,13 +1121,13 @@ impl LoweringContext<'_> {
11211121 //
11221122 // If `<pattern>` is a simple ident, then it is lowered to a single
11231123 // `let <pattern> = <pattern>;` statement as an optimization.
1124- for ( index, argument ) in decl. inputs . iter ( ) . enumerate ( ) {
1125- let argument = this. lower_arg ( argument ) ;
1126- let span = argument . pat . span ;
1124+ for ( index, parameter ) in decl. inputs . iter ( ) . enumerate ( ) {
1125+ let parameter = this. lower_param ( parameter ) ;
1126+ let span = parameter . pat . span ;
11271127
11281128 // Check if this is a binding pattern, if so, we can optimize and avoid adding a
1129- // `let <pat> = __argN;` statement. In this case, we do not rename the argument .
1130- let ( ident, is_simple_argument ) = match argument . pat . node {
1129+ // `let <pat> = __argN;` statement. In this case, we do not rename the parameter .
1130+ let ( ident, is_simple_parameter ) = match parameter . pat . node {
11311131 hir:: PatKind :: Binding ( hir:: BindingAnnotation :: Unannotated , _, ident, _) =>
11321132 ( ident, true ) ,
11331133 _ => {
@@ -1142,32 +1142,32 @@ impl LoweringContext<'_> {
11421142 let desugared_span =
11431143 this. mark_span_with_reason ( DesugaringKind :: Async , span, None ) ;
11441144
1145- // Construct an argument representing `__argN: <ty>` to replace the argument of the
1145+ // Construct a parameter representing `__argN: <ty>` to replace the parameter of the
11461146 // async function.
11471147 //
1148- // If this is the simple case, this argument will end up being the same as the
1149- // original argument , but with a different pattern id.
1148+ // If this is the simple case, this parameter will end up being the same as the
1149+ // original parameter , but with a different pattern id.
11501150 let mut stmt_attrs = ThinVec :: new ( ) ;
1151- stmt_attrs. extend ( argument . attrs . iter ( ) . cloned ( ) ) ;
1152- let ( new_argument_pat , new_argument_id ) = this. pat_ident ( desugared_span, ident) ;
1153- let new_argument = hir:: Arg {
1154- attrs : argument . attrs ,
1155- hir_id : argument . hir_id ,
1156- pat : new_argument_pat ,
1157- span : argument . span ,
1151+ stmt_attrs. extend ( parameter . attrs . iter ( ) . cloned ( ) ) ;
1152+ let ( new_parameter_pat , new_parameter_id ) = this. pat_ident ( desugared_span, ident) ;
1153+ let new_parameter = hir:: Param {
1154+ attrs : parameter . attrs ,
1155+ hir_id : parameter . hir_id ,
1156+ pat : new_parameter_pat ,
1157+ span : parameter . span ,
11581158 } ;
11591159
11601160
1161- if is_simple_argument {
1161+ if is_simple_parameter {
11621162 // If this is the simple case, then we only insert one statement that is
11631163 // `let <pat> = <pat>;`. We re-use the original argument's pattern so that
11641164 // `HirId`s are densely assigned.
1165- let expr = this. expr_ident ( desugared_span, ident, new_argument_id ) ;
1165+ let expr = this. expr_ident ( desugared_span, ident, new_parameter_id ) ;
11661166 let stmt = this. stmt_let_pat (
11671167 stmt_attrs,
11681168 desugared_span,
11691169 Some ( P ( expr) ) ,
1170- argument . pat ,
1170+ parameter . pat ,
11711171 hir:: LocalSource :: AsyncFn
11721172 ) ;
11731173 statements. push ( stmt) ;
@@ -1179,7 +1179,7 @@ impl LoweringContext<'_> {
11791179 // let <pat> = __argN;
11801180 // ```
11811181 //
1182- // The first statement moves the argument into the closure and thus ensures
1182+ // The first statement moves the parameter into the closure and thus ensures
11831183 // that the drop order is correct.
11841184 //
11851185 // The second statement creates the bindings that the user wrote.
@@ -1189,7 +1189,7 @@ impl LoweringContext<'_> {
11891189 // statement.
11901190 let ( move_pat, move_id) = this. pat_ident_binding_mode (
11911191 desugared_span, ident, hir:: BindingAnnotation :: Mutable ) ;
1192- let move_expr = this. expr_ident ( desugared_span, ident, new_argument_id ) ;
1192+ let move_expr = this. expr_ident ( desugared_span, ident, new_parameter_id ) ;
11931193 let move_stmt = this. stmt_let_pat (
11941194 ThinVec :: new ( ) ,
11951195 desugared_span,
@@ -1199,21 +1199,21 @@ impl LoweringContext<'_> {
11991199 ) ;
12001200
12011201 // Construct the `let <pat> = __argN;` statement. We re-use the original
1202- // argument 's pattern so that `HirId`s are densely assigned.
1202+ // parameter 's pattern so that `HirId`s are densely assigned.
12031203 let pattern_expr = this. expr_ident ( desugared_span, ident, move_id) ;
12041204 let pattern_stmt = this. stmt_let_pat (
12051205 stmt_attrs,
12061206 desugared_span,
12071207 Some ( P ( pattern_expr) ) ,
1208- argument . pat ,
1208+ parameter . pat ,
12091209 hir:: LocalSource :: AsyncFn
12101210 ) ;
12111211
12121212 statements. push ( move_stmt) ;
12131213 statements. push ( pattern_stmt) ;
12141214 } ;
12151215
1216- arguments . push ( new_argument ) ;
1216+ parameters . push ( new_parameter ) ;
12171217 }
12181218
12191219 let async_expr = this. make_async_expr (
@@ -1222,7 +1222,7 @@ impl LoweringContext<'_> {
12221222 let body = this. lower_block_with_stmts ( body, false , statements) ;
12231223 this. expr_block ( body, ThinVec :: new ( ) )
12241224 } ) ;
1225- ( HirVec :: from ( arguments ) , this. expr ( body. span , async_expr, ThinVec :: new ( ) ) )
1225+ ( HirVec :: from ( parameters ) , this. expr ( body. span , async_expr, ThinVec :: new ( ) ) )
12261226 } )
12271227 }
12281228
0 commit comments