fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #71365 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4fb7144ed15

1.43.0
3.7 KiB91 linesraw
1error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block
2  --> $DIR/union-unsafe.rs:22:5
3   |
4LL |     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
9error[E0133]: access to union field is unsafe and requires unsafe function or block
10  --> $DIR/union-unsafe.rs:23:6
11   |
12LL |     *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
17error[E0133]: access to union field is unsafe and requires unsafe function or block
18  --> $DIR/union-unsafe.rs:29:6
19   |
20LL |     *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
25error[E0133]: access to union field is unsafe and requires unsafe function or block
26  --> $DIR/union-unsafe.rs:37:13
27   |
28LL |     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
33error[E0133]: access to union field is unsafe and requires unsafe function or block
34  --> $DIR/union-unsafe.rs:40:14
35   |
36LL |     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
41error[E0133]: access to union field is unsafe and requires unsafe function or block
42  --> $DIR/union-unsafe.rs:41:20
43   |
44LL |     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
49error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block
50  --> $DIR/union-unsafe.rs:45:5
51   |
52LL |     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
57error[E0133]: access to union field is unsafe and requires unsafe function or block
58  --> $DIR/union-unsafe.rs:46:6
59   |
60LL |     *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
65error[E0133]: access to union field is unsafe and requires unsafe function or block
66  --> $DIR/union-unsafe.rs:50:6
67   |
68LL |     *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
73error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block
74  --> $DIR/union-unsafe.rs:53:5
75   |
76LL |     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
81error[E0133]: access to union field is unsafe and requires unsafe function or block
82  --> $DIR/union-unsafe.rs:54:6
83   |
84LL |     *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
89error: aborting due to 11 previous errors
90
91For more information about this error, try `rustc --explain E0133`.