@@ -720,7 +720,7 @@ impl LoweringContext<'_> {
720
720
(
721
721
// Disallow impl Trait in foreign items
722
722
this. lower_fn_decl ( fdec, None , false , None ) ,
723
- this. lower_fn_args_to_names ( fdec) ,
723
+ this. lower_fn_params_to_names ( fdec) ,
724
724
)
725
725
} ,
726
726
) ;
@@ -827,7 +827,7 @@ impl LoweringContext<'_> {
827
827
) ,
828
828
) ,
829
829
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 ) ;
831
831
let ( generics, sig) = self . lower_method_sig (
832
832
& i. generics ,
833
833
sig,
@@ -1028,10 +1028,10 @@ impl LoweringContext<'_> {
1028
1028
}
1029
1029
}
1030
1030
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 {
1032
1032
let body = hir:: Body {
1033
1033
generator_kind : self . generator_kind ,
1034
- arguments ,
1034
+ params ,
1035
1035
value,
1036
1036
} ;
1037
1037
let id = body. id ( ) ;
@@ -1041,21 +1041,21 @@ impl LoweringContext<'_> {
1041
1041
1042
1042
fn lower_body (
1043
1043
& mut self ,
1044
- f : impl FnOnce ( & mut LoweringContext < ' _ > ) -> ( HirVec < hir:: Arg > , hir:: Expr ) ,
1044
+ f : impl FnOnce ( & mut LoweringContext < ' _ > ) -> ( HirVec < hir:: Param > , hir:: Expr ) ,
1045
1045
) -> hir:: BodyId {
1046
1046
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) ;
1049
1049
self . generator_kind = prev_gen_kind;
1050
1050
body_id
1051
1051
}
1052
1052
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 ,
1059
1059
}
1060
1060
}
1061
1061
@@ -1065,7 +1065,7 @@ impl LoweringContext<'_> {
1065
1065
body : impl FnOnce ( & mut LoweringContext < ' _ > ) -> hir:: Expr ,
1066
1066
) -> hir:: BodyId {
1067
1067
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 ( ) ,
1069
1069
body ( this) ,
1070
1070
) )
1071
1071
}
@@ -1093,10 +1093,10 @@ impl LoweringContext<'_> {
1093
1093
} ;
1094
1094
1095
1095
self . lower_body ( |this| {
1096
- let mut arguments : Vec < hir:: Arg > = Vec :: new ( ) ;
1096
+ let mut parameters : Vec < hir:: Param > = Vec :: new ( ) ;
1097
1097
let mut statements: Vec < hir:: Stmt > = Vec :: new ( ) ;
1098
1098
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
1100
1100
// captured and so that the drop order matches the equivalent non-async functions.
1101
1101
//
1102
1102
// from:
@@ -1121,13 +1121,13 @@ impl LoweringContext<'_> {
1121
1121
//
1122
1122
// If `<pattern>` is a simple ident, then it is lowered to a single
1123
1123
// `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 ;
1127
1127
1128
1128
// 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 {
1131
1131
hir:: PatKind :: Binding ( hir:: BindingAnnotation :: Unannotated , _, ident, _) =>
1132
1132
( ident, true ) ,
1133
1133
_ => {
@@ -1142,32 +1142,32 @@ impl LoweringContext<'_> {
1142
1142
let desugared_span =
1143
1143
this. mark_span_with_reason ( DesugaringKind :: Async , span, None ) ;
1144
1144
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
1146
1146
// async function.
1147
1147
//
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.
1150
1150
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 ,
1158
1158
} ;
1159
1159
1160
1160
1161
- if is_simple_argument {
1161
+ if is_simple_parameter {
1162
1162
// If this is the simple case, then we only insert one statement that is
1163
1163
// `let <pat> = <pat>;`. We re-use the original argument's pattern so that
1164
1164
// `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 ) ;
1166
1166
let stmt = this. stmt_let_pat (
1167
1167
stmt_attrs,
1168
1168
desugared_span,
1169
1169
Some ( P ( expr) ) ,
1170
- argument . pat ,
1170
+ parameter . pat ,
1171
1171
hir:: LocalSource :: AsyncFn
1172
1172
) ;
1173
1173
statements. push ( stmt) ;
@@ -1179,7 +1179,7 @@ impl LoweringContext<'_> {
1179
1179
// let <pat> = __argN;
1180
1180
// ```
1181
1181
//
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
1183
1183
// that the drop order is correct.
1184
1184
//
1185
1185
// The second statement creates the bindings that the user wrote.
@@ -1189,7 +1189,7 @@ impl LoweringContext<'_> {
1189
1189
// statement.
1190
1190
let ( move_pat, move_id) = this. pat_ident_binding_mode (
1191
1191
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 ) ;
1193
1193
let move_stmt = this. stmt_let_pat (
1194
1194
ThinVec :: new ( ) ,
1195
1195
desugared_span,
@@ -1199,21 +1199,21 @@ impl LoweringContext<'_> {
1199
1199
) ;
1200
1200
1201
1201
// 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.
1203
1203
let pattern_expr = this. expr_ident ( desugared_span, ident, move_id) ;
1204
1204
let pattern_stmt = this. stmt_let_pat (
1205
1205
stmt_attrs,
1206
1206
desugared_span,
1207
1207
Some ( P ( pattern_expr) ) ,
1208
- argument . pat ,
1208
+ parameter . pat ,
1209
1209
hir:: LocalSource :: AsyncFn
1210
1210
) ;
1211
1211
1212
1212
statements. push ( move_stmt) ;
1213
1213
statements. push ( pattern_stmt) ;
1214
1214
} ;
1215
1215
1216
- arguments . push ( new_argument ) ;
1216
+ parameters . push ( new_parameter ) ;
1217
1217
}
1218
1218
1219
1219
let async_expr = this. make_async_expr (
@@ -1222,7 +1222,7 @@ impl LoweringContext<'_> {
1222
1222
let body = this. lower_block_with_stmts ( body, false , statements) ;
1223
1223
this. expr_block ( body, ThinVec :: new ( ) )
1224
1224
} ) ;
1225
- ( HirVec :: from ( arguments ) , this. expr ( body. span , async_expr, ThinVec :: new ( ) ) )
1225
+ ( HirVec :: from ( parameters ) , this. expr ( body. span , async_expr, ThinVec :: new ( ) ) )
1226
1226
} )
1227
1227
}
1228
1228
0 commit comments