@@ -104,7 +104,7 @@ impl Parse for Newtype {
104
104
#gate_rustc_only
105
105
impl <E : :: rustc_serialize:: Encoder > :: rustc_serialize:: Encodable <E > for #name {
106
106
fn encode( & self , e: & mut E ) {
107
- e. emit_u32( self . private ) ;
107
+ e. emit_u32( self . as_u32 ( ) ) ;
108
108
}
109
109
}
110
110
}
@@ -164,7 +164,7 @@ impl Parse for Newtype {
164
164
#[ inline]
165
165
fn eq( l: & Option <Self >, r: & Option <Self >) -> bool {
166
166
if #max_val < u32 :: MAX {
167
- l. map( |i| i. private ) . unwrap_or( #max_val+1 ) == r. map( |i| i. private ) . unwrap_or( #max_val+1 )
167
+ l. map( |i| i. as_u32 ( ) ) . unwrap_or( #max_val+1 ) == r. map( |i| i. as_u32 ( ) ) . unwrap_or( #max_val+1 )
168
168
} else {
169
169
match ( l, r) {
170
170
( Some ( l) , Some ( r) ) => r == l,
@@ -188,7 +188,7 @@ impl Parse for Newtype {
188
188
#[ cfg_attr( #gate_rustc_only_cfg, rustc_layout_scalar_valid_range_end( #max) ) ]
189
189
#[ cfg_attr( #gate_rustc_only_cfg, rustc_pass_by_value) ]
190
190
#vis struct #name {
191
- private : u32 ,
191
+ private_use_as_methods_instead : u32 ,
192
192
}
193
193
194
194
#( #consts) *
@@ -238,7 +238,7 @@ impl Parse for Newtype {
238
238
/// Prefer using `from_u32`.
239
239
#[ inline]
240
240
#vis const unsafe fn from_u32_unchecked( value: u32 ) -> Self {
241
- Self { private : value }
241
+ Self { private_use_as_methods_instead : value }
242
242
}
243
243
244
244
/// Extracts the value of this index as a `usize`.
@@ -250,7 +250,7 @@ impl Parse for Newtype {
250
250
/// Extracts the value of this index as a `u32`.
251
251
#[ inline]
252
252
#vis const fn as_u32( self ) -> u32 {
253
- self . private
253
+ self . private_use_as_methods_instead
254
254
}
255
255
256
256
/// Extracts the value of this index as a `usize`.
0 commit comments