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
@@ -826,7 +826,7 @@ impl<'a> MethodDef<'a> {
826
826
827
827
for ( i, ty) in self . args . iter ( ) . enumerate ( ) {
828
828
let ast_ty = ty. to_ty ( cx, trait_. span , type_ident, generics) ;
829
- let ident = cx. ident_of ( & format ! ( "__arg_ {}" , i) ) ;
829
+ let ident = cx. ident_of ( & format ! ( "arg_ {}" , i) ) ;
830
830
arg_tys. push ( ( ident, ast_ty) ) ;
831
831
832
832
let arg_expr = cx. expr_ident ( trait_. span , ident) ;
@@ -911,12 +911,12 @@ impl<'a> MethodDef<'a> {
911
911
///
912
912
/// // equivalent to:
913
913
/// impl PartialEq for A {
914
- /// fn eq(&self, __arg_1 : &A) -> bool {
914
+ /// fn eq(&self, arg_1 : &A) -> bool {
915
915
/// match *self {
916
- /// A {x: ref __self_0_0 , y: ref __self_0_1 } => {
917
- /// match *__arg_1 {
918
- /// A {x: ref __self_1_0 , y: ref __self_1_1 } => {
919
- /// __self_0_0 .eq(__self_1_0 ) && __self_0_1 .eq(__self_1_1 )
916
+ /// A {x: ref self_0_0 , y: ref self_0_1 } => {
917
+ /// match *arg_1 {
918
+ /// A {x: ref self_1_0 , y: ref self_1_1 } => {
919
+ /// self_0_0 .eq(self_1_0 ) && self_0_1 .eq(self_1_1 )
920
920
/// }
921
921
/// }
922
922
/// }
@@ -942,7 +942,7 @@ impl<'a> MethodDef<'a> {
942
942
trait_. create_struct_pattern ( cx,
943
943
struct_path,
944
944
struct_def,
945
- & format ! ( "__self_ {}" ,
945
+ & format ! ( "self_ {}" ,
946
946
i) ,
947
947
ast:: Mutability :: Immutable ) ;
948
948
patterns. push ( pat) ;
@@ -1020,25 +1020,25 @@ impl<'a> MethodDef<'a> {
1020
1020
/// // is equivalent to
1021
1021
///
1022
1022
/// impl PartialEq for A {
1023
- /// fn eq(&self, __arg_1 : &A) -> ::bool {
1024
- /// match (&*self, &*__arg_1 ) {
1023
+ /// fn eq(&self, arg_1 : &A) -> ::bool {
1024
+ /// match (&*self, &*arg_1 ) {
1025
1025
/// (&A1, &A1) => true,
1026
- /// (&A2(ref __self_0 ),
1027
- /// &A2(ref __arg_1_0 )) => (*__self_0 ).eq(&(*__arg_1_0 )),
1026
+ /// (&A2(ref self_0 ),
1027
+ /// &A2(ref arg_1_0 )) => (*self_0 ).eq(&(*arg_1_0 )),
1028
1028
/// _ => {
1029
- /// let __self_vi = match *self { A1(..) => 0, A2(..) => 1 };
1030
- /// let __arg_1_vi = match *__arg_1 { A1(..) => 0, A2(..) => 1 };
1029
+ /// let self_vi = match *self { A1(..) => 0, A2(..) => 1 };
1030
+ /// let arg_1_vi = match *arg_1 { A1(..) => 0, A2(..) => 1 };
1031
1031
/// false
1032
1032
/// }
1033
1033
/// }
1034
1034
/// }
1035
1035
/// }
1036
1036
/// ```
1037
1037
///
1038
- /// (Of course `__self_vi ` and `__arg_1_vi ` are unused for
1038
+ /// (Of course `self_vi ` and `arg_1_vi ` are unused for
1039
1039
/// `PartialEq`, and those subcomputations will hopefully be removed
1040
- /// as their results are unused. The point of `__self_vi ` and
1041
- /// `__arg_1_vi ` is for `PartialOrd`; see #15503.)
1040
+ /// as their results are unused. The point of `self_vi ` and
1041
+ /// `arg_1_vi ` is for `PartialOrd`; see #15503.)
1042
1042
fn expand_enum_method_body < ' b > ( & self ,
1043
1043
cx : & mut ExtCtxt ,
1044
1044
trait_ : & TraitDef < ' b > ,
@@ -1069,14 +1069,14 @@ impl<'a> MethodDef<'a> {
1069
1069
/// for each of the self-args, carried in precomputed variables.
1070
1070
1071
1071
/// ```{.text}
1072
- /// let __self0_vi = unsafe {
1072
+ /// let self0_vi = unsafe {
1073
1073
/// std::intrinsics::discriminant_value(&self) } as i32;
1074
- /// let __self1_vi = unsafe {
1075
- /// std::intrinsics::discriminant_value(&__arg1 ) } as i32;
1076
- /// let __self2_vi = unsafe {
1077
- /// std::intrinsics::discriminant_value(&__arg2 ) } as i32;
1074
+ /// let self1_vi = unsafe {
1075
+ /// std::intrinsics::discriminant_value(&arg1 ) } as i32;
1076
+ /// let self2_vi = unsafe {
1077
+ /// std::intrinsics::discriminant_value(&arg2 ) } as i32;
1078
1078
///
1079
- /// if __self0_vi == __self1_vi && __self0_vi == __self2_vi && ... {
1079
+ /// if self0_vi == self1_vi && self0_vi == self2_vi && ... {
1080
1080
/// match (...) {
1081
1081
/// (Variant1, Variant1, ...) => Body1
1082
1082
/// (Variant2, Variant2, ...) => Body2,
@@ -1104,9 +1104,9 @@ impl<'a> MethodDef<'a> {
1104
1104
let self_arg_names = self_args. iter ( ) . enumerate ( )
1105
1105
. map ( |( arg_count, _self_arg) | {
1106
1106
if arg_count == 0 {
1107
- "__self " . to_string ( )
1107
+ "self " . to_string ( )
1108
1108
} else {
1109
- format ! ( "__arg_ {}" , arg_count)
1109
+ format ! ( "arg_ {}" , arg_count)
1110
1110
}
1111
1111
} )
1112
1112
. collect :: < Vec < String > > ( ) ;
@@ -1243,17 +1243,17 @@ impl<'a> MethodDef<'a> {
1243
1243
// with three Self args, builds three statements:
1244
1244
//
1245
1245
// ```
1246
- // let __self0_vi = unsafe {
1246
+ // let self0_vi = unsafe {
1247
1247
// std::intrinsics::discriminant_value(&self) } as i32;
1248
- // let __self1_vi = unsafe {
1249
- // std::intrinsics::discriminant_value(&__arg1 ) } as i32;
1250
- // let __self2_vi = unsafe {
1251
- // std::intrinsics::discriminant_value(&__arg2 ) } as i32;
1248
+ // let self1_vi = unsafe {
1249
+ // std::intrinsics::discriminant_value(&arg1 ) } as i32;
1250
+ // let self2_vi = unsafe {
1251
+ // std::intrinsics::discriminant_value(&arg2 ) } as i32;
1252
1252
// ```
1253
1253
let mut index_let_stmts: Vec < ast:: Stmt > = Vec :: new ( ) ;
1254
1254
1255
1255
//We also build an expression which checks whether all discriminants are equal
1256
- // discriminant_test = __self0_vi == __self1_vi && __self0_vi == __self2_vi && ...
1256
+ // discriminant_test = self0_vi == self1_vi && self0_vi == self2_vi && ...
1257
1257
let mut discriminant_test = cx. expr_bool ( sp, true ) ;
1258
1258
1259
1259
let target_type_name =
@@ -1312,7 +1312,7 @@ impl<'a> MethodDef<'a> {
1312
1312
// down to desired l-values, but we cannot actually deref
1313
1313
// them when they are fed as r-values into a tuple
1314
1314
// expression; here add a layer of borrowing, turning
1315
- // `(*self, *__arg_0 , ...)` into `(&*self, &*__arg_0 , ...)`.
1315
+ // `(*self, *arg_0 , ...)` into `(&*self, &*arg_0 , ...)`.
1316
1316
let borrowed_self_args = self_args. move_map ( |self_arg| cx. expr_addr_of ( sp, self_arg) ) ;
1317
1317
let match_arg = cx. expr ( sp, ast:: ExprKind :: Tup ( borrowed_self_args) ) ;
1318
1318
@@ -1326,7 +1326,7 @@ impl<'a> MethodDef<'a> {
1326
1326
// }
1327
1327
// }
1328
1328
// else {
1329
- // <delegated expression referring to __self0_vi , et al.>
1329
+ // <delegated expression referring to self0_vi , et al.>
1330
1330
// }
1331
1331
let all_match = cx. expr_match ( sp, match_arg, match_arms) ;
1332
1332
let arm_expr = cx. expr_if ( sp, discriminant_test, all_match, Some ( arm_expr) ) ;
@@ -1350,8 +1350,8 @@ impl<'a> MethodDef<'a> {
1350
1350
// error-prone, since the catch-all as defined above would
1351
1351
// generate code like this:
1352
1352
//
1353
- // _ => { let __self0 = match *self { };
1354
- // let __self1 = match *__arg_0 { };
1353
+ // _ => { let self0 = match *self { };
1354
+ // let self1 = match *arg_0 { };
1355
1355
// <catch-all-expr> }
1356
1356
//
1357
1357
// Which is yields bindings for variables which type
@@ -1390,7 +1390,7 @@ impl<'a> MethodDef<'a> {
1390
1390
// down to desired l-values, but we cannot actually deref
1391
1391
// them when they are fed as r-values into a tuple
1392
1392
// expression; here add a layer of borrowing, turning
1393
- // `(*self, *__arg_0 , ...)` into `(&*self, &*__arg_0 , ...)`.
1393
+ // `(*self, *arg_0 , ...)` into `(&*self, &*arg_0 , ...)`.
1394
1394
let borrowed_self_args = self_args. move_map ( |self_arg| cx. expr_addr_of ( sp, self_arg) ) ;
1395
1395
let match_arg = cx. expr ( sp, ast:: ExprKind :: Tup ( borrowed_self_args) ) ;
1396
1396
cx. expr_match ( sp, match_arg, match_arms)
@@ -1604,8 +1604,8 @@ pub fn cs_fold<F>(use_foldl: bool,
1604
1604
/// process the collected results. i.e.
1605
1605
///
1606
1606
/// ```ignore
1607
- /// f(cx, span, vec![self_1.method(__arg_1_1, __arg_2_1 ),
1608
- /// self_2.method(__arg_1_2, __arg_2_2 )])
1607
+ /// f(cx, span, vec![self_1.method(arg_1_1, arg_2_1 ),
1608
+ /// self_2.method(arg_1_2, arg_2_2 )])
1609
1609
/// ```
1610
1610
#[ inline]
1611
1611
pub fn cs_same_method < F > ( f : F ,
0 commit comments