156
156
//!
157
157
//! ```{.text}
158
158
//! EnumNonMatchingCollapsed(
159
- //! vec![<ident of self>, <ident of arg_1 >],
159
+ //! vec![<ident of self>, <ident of __arg_1 >],
160
160
//! &[<ast::Variant for C0>, <ast::Variant for C1>],
161
- //! &[<ident for self index value>, <ident of arg_1 index value>])
161
+ //! &[<ident for self index value>, <ident of __arg_1 index value>])
162
162
//! ```
163
163
//!
164
164
//! It is the same for when the arguments are flipped to `C1 {x}` and
165
165
//! `C0(a)`; the only difference is what the values of the identifiers
166
- //! <ident for self index value> and <ident of arg_1 index value> will
166
+ //! <ident for self index value> and <ident of __arg_1 index value> will
167
167
//! be in the generated code.
168
168
//!
169
169
//! `EnumNonMatchingCollapsed` deliberately provides far less information
@@ -843,7 +843,7 @@ impl<'a> MethodDef<'a> {
843
843
844
844
for ( i, ty) in self . args . iter ( ) . enumerate ( ) {
845
845
let ast_ty = ty. to_ty ( cx, trait_. span , type_ident, generics) ;
846
- let ident = cx. ident_of ( & format ! ( "arg_ {}" , i) ) ;
846
+ let ident = cx. ident_of ( & format ! ( "__arg_ {}" , i) ) ;
847
847
arg_tys. push ( ( ident, ast_ty) ) ;
848
848
849
849
let arg_expr = cx. expr_ident ( trait_. span , ident) ;
@@ -929,12 +929,12 @@ impl<'a> MethodDef<'a> {
929
929
///
930
930
/// // equivalent to:
931
931
/// impl PartialEq for A {
932
- /// fn eq(&self, arg_1 : &A) -> bool {
932
+ /// fn eq(&self, __arg_1 : &A) -> bool {
933
933
/// match *self {
934
- /// A {x: ref self_0_0 , y: ref self_0_1 } => {
935
- /// match *arg_1 {
936
- /// A {x: ref self_1_0 , y: ref self_1_1 } => {
937
- /// self_0_0 .eq(self_1_0 ) && self_0_1 .eq(self_1_1 )
934
+ /// A {x: ref __self_0_0 , y: ref __self_0_1 } => {
935
+ /// match *__arg_1 {
936
+ /// A {x: ref __self_1_0 , y: ref __self_1_1 } => {
937
+ /// __self_0_0 .eq(__self_1_0 ) && __self_0_1 .eq(__self_1_1 )
938
938
/// }
939
939
/// }
940
940
/// }
@@ -960,7 +960,7 @@ impl<'a> MethodDef<'a> {
960
960
trait_. create_struct_pattern ( cx,
961
961
struct_path,
962
962
struct_def,
963
- & format ! ( "self_ {}" ,
963
+ & format ! ( "__self_ {}" ,
964
964
i) ,
965
965
ast:: Mutability :: Immutable ) ;
966
966
patterns. push ( pat) ;
@@ -1038,25 +1038,25 @@ impl<'a> MethodDef<'a> {
1038
1038
/// // is equivalent to
1039
1039
///
1040
1040
/// impl PartialEq for A {
1041
- /// fn eq(&self, arg_1 : &A) -> ::bool {
1042
- /// match (&*self, &*arg_1 ) {
1041
+ /// fn eq(&self, __arg_1 : &A) -> ::bool {
1042
+ /// match (&*self, &*__arg_1 ) {
1043
1043
/// (&A1, &A1) => true,
1044
1044
/// (&A2(ref self_0),
1045
- /// &A2(ref arg_1_0 )) => (*self_0).eq(&(*arg_1_0 )),
1045
+ /// &A2(ref __arg_1_0 )) => (*self_0).eq(&(*__arg_1_0 )),
1046
1046
/// _ => {
1047
- /// let self_vi = match *self { A1(..) => 0, A2(..) => 1 };
1048
- /// let arg_1_vi = match *arg_1 { A1(..) => 0, A2(..) => 1 };
1047
+ /// let __self_vi = match *self { A1(..) => 0, A2(..) => 1 };
1048
+ /// let __arg_1_vi = match *__arg_1 { A1(..) => 0, A2(..) => 1 };
1049
1049
/// false
1050
1050
/// }
1051
1051
/// }
1052
1052
/// }
1053
1053
/// }
1054
1054
/// ```
1055
1055
///
1056
- /// (Of course `self_vi ` and `arg_1_vi ` are unused for
1056
+ /// (Of course `__self_vi ` and `__arg_1_vi ` are unused for
1057
1057
/// `PartialEq`, and those subcomputations will hopefully be removed
1058
- /// as their results are unused. The point of `self_vi ` and
1059
- /// `arg_1_vi ` is for `PartialOrd`; see #15503.)
1058
+ /// as their results are unused. The point of `__self_vi ` and
1059
+ /// `__arg_1_vi ` is for `PartialOrd`; see #15503.)
1060
1060
fn expand_enum_method_body < ' b > ( & self ,
1061
1061
cx : & mut ExtCtxt ,
1062
1062
trait_ : & TraitDef < ' b > ,
@@ -1087,14 +1087,14 @@ impl<'a> MethodDef<'a> {
1087
1087
/// for each of the self-args, carried in precomputed variables.
1088
1088
1089
1089
/// ```{.text}
1090
- /// let self0_vi = unsafe {
1090
+ /// let __self0_vi = unsafe {
1091
1091
/// std::intrinsics::discriminant_value(&self) } as i32;
1092
- /// let self1_vi = unsafe {
1092
+ /// let __self1_vi = unsafe {
1093
1093
/// std::intrinsics::discriminant_value(&arg1) } as i32;
1094
- /// let self2_vi = unsafe {
1094
+ /// let __self2_vi = unsafe {
1095
1095
/// std::intrinsics::discriminant_value(&arg2) } as i32;
1096
1096
///
1097
- /// if self0_vi == self1_vi && self0_vi == self2_vi && ... {
1097
+ /// if __self0_vi == __self1_vi && __self0_vi == __self2_vi && ... {
1098
1098
/// match (...) {
1099
1099
/// (Variant1, Variant1, ...) => Body1
1100
1100
/// (Variant2, Variant2, ...) => Body2,
@@ -1122,9 +1122,9 @@ impl<'a> MethodDef<'a> {
1122
1122
let self_arg_names = self_args. iter ( ) . enumerate ( )
1123
1123
. map ( |( arg_count, _self_arg) | {
1124
1124
if arg_count == 0 {
1125
- "self " . to_string ( )
1125
+ "__self " . to_string ( )
1126
1126
} else {
1127
- format ! ( "arg_ {}" , arg_count)
1127
+ format ! ( "__arg_ {}" , arg_count)
1128
1128
}
1129
1129
} )
1130
1130
. collect :: < Vec < String > > ( ) ;
@@ -1261,17 +1261,17 @@ impl<'a> MethodDef<'a> {
1261
1261
// with three Self args, builds three statements:
1262
1262
//
1263
1263
// ```
1264
- // let self0_vi = unsafe {
1264
+ // let __self0_vi = unsafe {
1265
1265
// std::intrinsics::discriminant_value(&self) } as i32;
1266
- // let self1_vi = unsafe {
1266
+ // let __self1_vi = unsafe {
1267
1267
// std::intrinsics::discriminant_value(&arg1) } as i32;
1268
- // let self2_vi = unsafe {
1268
+ // let __self2_vi = unsafe {
1269
1269
// std::intrinsics::discriminant_value(&arg2) } as i32;
1270
1270
// ```
1271
1271
let mut index_let_stmts: Vec < ast:: Stmt > = Vec :: new ( ) ;
1272
1272
1273
1273
//We also build an expression which checks whether all discriminants are equal
1274
- // discriminant_test = self0_vi == self1_vi && self0_vi == self2_vi && ...
1274
+ // discriminant_test = __self0_vi == __self1_vi && __self0_vi == __self2_vi && ...
1275
1275
let mut discriminant_test = cx. expr_bool ( sp, true ) ;
1276
1276
1277
1277
let target_type_name =
@@ -1321,7 +1321,7 @@ impl<'a> MethodDef<'a> {
1321
1321
// down to desired l-values, but we cannot actually deref
1322
1322
// them when they are fed as r-values into a tuple
1323
1323
// expression; here add a layer of borrowing, turning
1324
- // `(*self, *arg_0 , ...)` into `(&*self, &*arg_0 , ...)`.
1324
+ // `(*self, *__arg_0 , ...)` into `(&*self, &*__arg_0 , ...)`.
1325
1325
let borrowed_self_args = self_args. move_map ( |self_arg| cx. expr_addr_of ( sp, self_arg) ) ;
1326
1326
let match_arg = cx. expr ( sp, ast:: ExprKind :: Tup ( borrowed_self_args) ) ;
1327
1327
@@ -1335,7 +1335,7 @@ impl<'a> MethodDef<'a> {
1335
1335
// }
1336
1336
// }
1337
1337
// else {
1338
- // <delegated expression referring to self0_vi , et al.>
1338
+ // <delegated expression referring to __self0_vi , et al.>
1339
1339
// }
1340
1340
let all_match = cx. expr_match ( sp, match_arg, match_arms) ;
1341
1341
let arm_expr = cx. expr_if ( sp, discriminant_test, all_match, Some ( arm_expr) ) ;
@@ -1359,8 +1359,8 @@ impl<'a> MethodDef<'a> {
1359
1359
// error-prone, since the catch-all as defined above would
1360
1360
// generate code like this:
1361
1361
//
1362
- // _ => { let self0 = match *self { };
1363
- // let self1 = match *arg_0 { };
1362
+ // _ => { let __self0 = match *self { };
1363
+ // let __self1 = match *__arg_0 { };
1364
1364
// <catch-all-expr> }
1365
1365
//
1366
1366
// Which is yields bindings for variables which type
@@ -1399,7 +1399,7 @@ impl<'a> MethodDef<'a> {
1399
1399
// down to desired l-values, but we cannot actually deref
1400
1400
// them when they are fed as r-values into a tuple
1401
1401
// expression; here add a layer of borrowing, turning
1402
- // `(*self, *arg_0 , ...)` into `(&*self, &*arg_0 , ...)`.
1402
+ // `(*self, *__arg_0 , ...)` into `(&*self, &*__arg_0 , ...)`.
1403
1403
let borrowed_self_args = self_args. move_map ( |self_arg| cx. expr_addr_of ( sp, self_arg) ) ;
1404
1404
let match_arg = cx. expr ( sp, ast:: ExprKind :: Tup ( borrowed_self_args) ) ;
1405
1405
cx. expr_match ( sp, match_arg, match_arms)
@@ -1613,8 +1613,8 @@ pub fn cs_fold<F>(use_foldl: bool,
1613
1613
/// process the collected results. i.e.
1614
1614
///
1615
1615
/// ```ignore
1616
- /// f(cx, span, vec![self_1.method(arg_1_1, arg_2_1 ),
1617
- /// self_2.method(arg_1_2, arg_2_2 )])
1616
+ /// f(cx, span, vec![self_1.method(__arg_1_1, __arg_2_1 ),
1617
+ /// self_2.method(__arg_1_2, __arg_2_2 )])
1618
1618
/// ```
1619
1619
#[ inline]
1620
1620
pub fn cs_same_method < F > ( f : F ,
0 commit comments