|
1 | 1 | error[E0133]: access to union field is unsafe and requires unsafe function or block
|
2 |
| - --> $DIR/union-unsafe.rs:22:6 |
| 2 | + --> $DIR/union-unsafe.rs:31:5 |
| 3 | + | |
| 4 | +LL | *(u.p) = 13; |
| 5 | + | ^^^^^^^^^^^ access to union field |
| 6 | + | |
| 7 | + = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior |
| 8 | + |
| 9 | +error[E0133]: assignment to union field that needs dropping is unsafe and requires unsafe function or block |
| 10 | + --> $DIR/union-unsafe.rs:35:5 |
| 11 | + | |
| 12 | +LL | u.a = (RefCell::new(0), 1); |
| 13 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to union field that needs dropping |
| 14 | + | |
| 15 | + = note: the previous content of the field will be dropped, which causes undefined behavior if the field was not properly initialized |
| 16 | + |
| 17 | +error[E0133]: assignment to union field that needs dropping is unsafe and requires unsafe function or block |
| 18 | + --> $DIR/union-unsafe.rs:36:5 |
| 19 | + | |
| 20 | +LL | u.a.0 = RefCell::new(0); |
| 21 | + | ^^^^^^^^^^^^^^^^^^^^^^^ assignment to union field that needs dropping |
| 22 | + | |
| 23 | + = note: the previous content of the field will be dropped, which causes undefined behavior if the field was not properly initialized |
| 24 | + |
| 25 | +error[E0133]: access to union field is unsafe and requires unsafe function or block |
| 26 | + --> $DIR/union-unsafe.rs:43:6 |
3 | 27 | |
|
4 | 28 | LL | *u3.a = T::default();
|
5 | 29 | | ^^^^ access to union field
|
6 | 30 | |
|
7 | 31 | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
|
8 | 32 |
|
9 | 33 | error[E0133]: access to union field is unsafe and requires unsafe function or block
|
10 |
| - --> $DIR/union-unsafe.rs:28:6 |
| 34 | + --> $DIR/union-unsafe.rs:49:6 |
11 | 35 | |
|
12 | 36 | LL | *u3.a = T::default();
|
13 | 37 | | ^^^^ access to union field
|
14 | 38 | |
|
15 | 39 | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
|
16 | 40 |
|
17 | 41 | error[E0133]: access to union field is unsafe and requires unsafe function or block
|
18 |
| - --> $DIR/union-unsafe.rs:36:13 |
| 42 | + --> $DIR/union-unsafe.rs:57:13 |
19 | 43 | |
|
20 | 44 | LL | let a = u1.a;
|
21 | 45 | | ^^^^ access to union field
|
22 | 46 | |
|
23 | 47 | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
|
24 | 48 |
|
25 | 49 | error[E0133]: access to union field is unsafe and requires unsafe function or block
|
26 |
| - --> $DIR/union-unsafe.rs:39:14 |
| 50 | + --> $DIR/union-unsafe.rs:60:14 |
27 | 51 | |
|
28 | 52 | LL | let U1 { a } = u1;
|
29 | 53 | | ^ access to union field
|
30 | 54 | |
|
31 | 55 | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
|
32 | 56 |
|
33 | 57 | error[E0133]: access to union field is unsafe and requires unsafe function or block
|
34 |
| - --> $DIR/union-unsafe.rs:40:20 |
| 58 | + --> $DIR/union-unsafe.rs:61:20 |
35 | 59 | |
|
36 | 60 | LL | if let U1 { a: 12 } = u1 {}
|
37 | 61 | | ^^ access to union field
|
38 | 62 | |
|
39 | 63 | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
|
40 | 64 |
|
41 | 65 | error[E0133]: access to union field is unsafe and requires unsafe function or block
|
42 |
| - --> $DIR/union-unsafe.rs:45:6 |
| 66 | + --> $DIR/union-unsafe.rs:66:6 |
43 | 67 | |
|
44 | 68 | LL | *u2.a = String::from("new");
|
45 | 69 | | ^^^^ access to union field
|
46 | 70 | |
|
47 | 71 | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
|
48 | 72 |
|
49 | 73 | error[E0133]: access to union field is unsafe and requires unsafe function or block
|
50 |
| - --> $DIR/union-unsafe.rs:49:6 |
| 74 | + --> $DIR/union-unsafe.rs:70:6 |
51 | 75 | |
|
52 | 76 | LL | *u3.a = 1;
|
53 | 77 | | ^^^^ access to union field
|
54 | 78 | |
|
55 | 79 | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
|
56 | 80 |
|
57 | 81 | error[E0133]: access to union field is unsafe and requires unsafe function or block
|
58 |
| - --> $DIR/union-unsafe.rs:53:6 |
| 82 | + --> $DIR/union-unsafe.rs:74:6 |
59 | 83 | |
|
60 | 84 | LL | *u3.a = String::from("new");
|
61 | 85 | | ^^^^ access to union field
|
62 | 86 | |
|
63 | 87 | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
|
64 | 88 |
|
65 |
| -error: aborting due to 8 previous errors |
| 89 | +error: aborting due to 11 previous errors |
66 | 90 |
|
67 | 91 | For more information about this error, try `rustc --explain E0133`.
|
0 commit comments