rust/src/test/ui/union/union-unsafe.stderr
2018-12-25 21:08:33 -07:00

52 lines
2.4 KiB
Plaintext

error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block
--> $DIR/union-unsafe.rs:21:5
|
LL | u3.a = T::default(); //~ ERROR assignment to non-`Copy` union field is unsafe
| ^^^^ assignment to non-`Copy` union field
|
= note: the previous content of the field will be dropped, which causes undefined behavior if the field was not properly initialized
error[E0133]: access to union field is unsafe and requires unsafe function or block
--> $DIR/union-unsafe.rs:33:13
|
LL | let a = u1.a; //~ ERROR access to union field is unsafe
| ^^^^ access to union field
|
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
--> $DIR/union-unsafe.rs:35:14
|
LL | let U1 { a } = u1; //~ ERROR access to union field is unsafe
| ^ access to union field
|
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
--> $DIR/union-unsafe.rs:36:20
|
LL | if let U1 { a: 12 } = u1 {} //~ ERROR access to union field is unsafe
| ^^ access to union field
|
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block
--> $DIR/union-unsafe.rs:40:5
|
LL | u2.a = String::from("new"); //~ ERROR assignment to non-`Copy` union field is unsafe
| ^^^^ assignment to non-`Copy` union field
|
= note: the previous content of the field will be dropped, which causes undefined behavior if the field was not properly initialized
error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block
--> $DIR/union-unsafe.rs:44:5
|
LL | u3.a = String::from("new"); //~ ERROR assignment to non-`Copy` union field is unsafe
| ^^^^ assignment to non-`Copy` union field
|
= note: the previous content of the field will be dropped, which causes undefined behavior if the field was not properly initialized
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0133`.