fork/rust

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

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

1.39.0
2.1 KiB51 linesraw
1error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block
2  --> $DIR/union-unsafe.rs:21:5
3   |
4LL |     u3.a = 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:33:13
11   |
12LL |     let a = u1.a;
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:35:14
19   |
20LL |     let U1 { a } = u1;
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:36:20
27   |
28LL |     if let U1 { a: 12 } = u1 {}
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]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block
34  --> $DIR/union-unsafe.rs:40:5
35   |
36LL |     u2.a = String::from("new");
37   |     ^^^^ assignment to non-`Copy` union field
38   |
39   = note: the previous content of the field will be dropped, which causes undefined behavior if the field was not properly initialized
40
41error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block
42  --> $DIR/union-unsafe.rs:44:5
43   |
44LL |     u3.a = String::from("new");
45   |     ^^^^ assignment to non-`Copy` union field
46   |
47   = note: the previous content of the field will be dropped, which causes undefined behavior if the field was not properly initialized
48
49error: aborting due to 6 previous errors
50
51For more information about this error, try `rustc --explain E0133`.