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