File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -240,22 +240,23 @@ fn init_fields(
240240 } ;
241241 let init = match kind {
242242 InitializerKind :: Value { ident, value } => {
243- let ( value_ident , value_prep ) = match value. as_ref ( ) {
243+ let ( value_prep , value_ident ) = match value. as_ref ( ) {
244244 None => {
245245 // This is of short-hand syntax, so just use the identifier directly.
246- ( ident. clone ( ) , None )
246+ ( None , ident. clone ( ) )
247247 }
248248 Some ( ( _, value) ) => {
249249 // We have an expression. Evaluate it to a local variable first, outside
250250 // `unsafe {}` block.
251251 //
252252 // Setting the span of `value_ident` to `value`'s span improves error messages
253253 // when the type of `value` is wrong.
254+ let value_ident = format_ident ! ( "value" , span = value. span( ) ) ;
254255 (
255- format_ident ! ( "value" , span = value. span( ) ) ,
256256 Some ( quote ! {
257- let value = #value;
257+ let #value_ident = #value;
258258 } ) ,
259+ value_ident,
259260 )
260261 }
261262 } ;
You can’t perform that action at this time.
0 commit comments