rust/src/test/ui/unsafe/union-assignop.mirunsafeck.stderr
2021-08-03 15:11:04 -04:00

60 lines
2.3 KiB
Plaintext

error[E0133]: access to union field is unsafe and requires unsafe function or block
--> $DIR/union-assignop.rs:20:5
|
LL | foo.a += 5;
| ^^^^^^^^^^ 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-assignop.rs:21:5
|
LL | foo.b += Dropping;
| ^^^^^ access to union field
|
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: assignment to union field that might need dropping is unsafe and requires unsafe function or block
--> $DIR/union-assignop.rs:22:5
|
LL | foo.b = Dropping;
| ^^^^^^^^^^^^^^^^ assignment to union field that might need dropping
|
= 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-assignop.rs:23:5
|
LL | foo.a;
| ^^^^^ 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-assignop.rs:25:5
|
LL | foo.b;
| ^^^^^ 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-assignop.rs:27:13
|
LL | foo.b = foo.b;
| ^^^^^ access to union field
|
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: assignment to union field that might need dropping is unsafe and requires unsafe function or block
--> $DIR/union-assignop.rs:27:5
|
LL | foo.b = foo.b;
| ^^^^^^^^^^^^^ assignment to union field that might need dropping
|
= 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 7 previous errors
For more information about this error, try `rustc --explain E0133`.