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