File tree Expand file tree Collapse file tree 1 file changed +23
-7
lines changed Expand file tree Collapse file tree 1 file changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -11,11 +11,6 @@ struct B {
1111 j : i64 ,
1212}
1313
14- #[ derive( Default ) ]
15- struct C {
16- i : i32 ,
17- }
18-
1914fn main ( ) {
2015 // wrong
2116 let mut a: A = Default :: default ( ) ;
@@ -31,8 +26,29 @@ fn main() {
3126 } ;
3227
3328 // right
34- let b = B { i : 42 , j : 24 } ;
29+ let mut a: A = Default :: default ( ) ;
30+ if a. i == 0 {
31+ a. j = 12 ;
32+ }
33+
34+ // right
35+ let mut a: A = Default :: default ( ) ;
36+ let b = 5 ;
37+
38+ // right
39+ let mut b = 32 ;
40+ let mut a: A = Default :: default ( ) ;
41+ b = 2 ;
42+
43+ // right
44+ let b: B = B { i : 42 , j : 24 } ;
45+
46+ // right
47+ let mut b: B = B { i : 42 , j : 24 } ;
48+ b. i = 52 ;
3549
3650 // right
37- let c: C = Default :: default ( ) ;
51+ let mut b = B { i : 15 , j : 16 } ;
52+ let mut a: A = Default :: default ( ) ;
53+ b. i = 2 ;
3854}
You can’t perform that action at this time.
0 commit comments