rust/src/test/ui/union/union-unsafe.stderr

52 lines
2.4 KiB
Plaintext
Raw Normal View History

2018-08-08 07:28:26 -05:00
error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block
2018-12-25 09:56:47 -06:00
--> $DIR/union-unsafe.rs:21:5
2018-08-08 07:28:26 -05:00
|
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
2018-12-25 09:56:47 -06:00
--> $DIR/union-unsafe.rs:33:13
2018-08-08 07:28:26 -05:00
|
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
2018-12-25 09:56:47 -06:00
--> $DIR/union-unsafe.rs:35:14
2018-08-08 07:28:26 -05:00
|
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
2018-12-25 09:56:47 -06:00
--> $DIR/union-unsafe.rs:36:20
2018-08-08 07:28:26 -05:00
|
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
2018-12-25 09:56:47 -06:00
--> $DIR/union-unsafe.rs:40:5
2018-08-08 07:28:26 -05:00
|
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
2018-12-25 09:56:47 -06:00
--> $DIR/union-unsafe.rs:44:5
2018-08-08 07:28:26 -05:00
|
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`.