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 {
11
11
j : i64 ,
12
12
}
13
13
14
- #[ derive( Default ) ]
15
- struct C {
16
- i : i32 ,
17
- }
18
-
19
14
fn main ( ) {
20
15
// wrong
21
16
let mut a: A = Default :: default ( ) ;
@@ -31,8 +26,29 @@ fn main() {
31
26
} ;
32
27
33
28
// 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 ;
35
49
36
50
// 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 ;
38
54
}
You can’t perform that action at this time.
0 commit comments