@@ -93,7 +93,7 @@ impl Parse for Newtype {
93
93
}
94
94
impl <E : :: rustc_serialize:: Encoder > :: rustc_serialize:: Encodable <E > for #name {
95
95
fn encode( & self , e: & mut E ) {
96
- e. emit_u32( self . private ) ;
96
+ e. emit_u32( self . as_u32 ( ) ) ;
97
97
}
98
98
}
99
99
}
@@ -150,7 +150,7 @@ impl Parse for Newtype {
150
150
#[ inline]
151
151
fn eq( l: & Option <Self >, r: & Option <Self >) -> bool {
152
152
if #max_val < u32 :: MAX {
153
- l. map( |i| i. private ) . unwrap_or( #max_val+1 ) == r. map( |i| i. private ) . unwrap_or( #max_val+1 )
153
+ l. map( |i| i. as_u32 ( ) ) . unwrap_or( #max_val+1 ) == r. map( |i| i. as_u32 ( ) ) . unwrap_or( #max_val+1 )
154
154
} else {
155
155
match ( l, r) {
156
156
( Some ( l) , Some ( r) ) => r == l,
@@ -174,7 +174,7 @@ impl Parse for Newtype {
174
174
#[ rustc_layout_scalar_valid_range_end( #max) ]
175
175
#[ rustc_pass_by_value]
176
176
#vis struct #name {
177
- private : u32 ,
177
+ private_use_as_methods_instead : u32 ,
178
178
}
179
179
180
180
#( #consts) *
@@ -224,7 +224,7 @@ impl Parse for Newtype {
224
224
/// Prefer using `from_u32`.
225
225
#[ inline]
226
226
#vis const unsafe fn from_u32_unchecked( value: u32 ) -> Self {
227
- Self { private : value }
227
+ Self { private_use_as_methods_instead : value as _ }
228
228
}
229
229
230
230
/// Extracts the value of this index as a `usize`.
@@ -236,7 +236,7 @@ impl Parse for Newtype {
236
236
/// Extracts the value of this index as a `u32`.
237
237
#[ inline]
238
238
#vis const fn as_u32( self ) -> u32 {
239
- self . private
239
+ self . private_use_as_methods_instead as u32
240
240
}
241
241
242
242
/// Extracts the value of this index as a `usize`.
0 commit comments