diff options
| author | Matthew Jasper <mjjasper1@gmail.com> | 2023-12-07 11:56:48 +0000 |
|---|---|---|
| committer | Matthew Jasper <mjjasper1@gmail.com> | 2024-01-05 10:00:59 +0000 |
| commit | 26f48b4cba17a6f7d321bccaa86b345596923763 (patch) | |
| tree | c87a2c12b38aefd49e780102ee32f81eaf6cf4a2 /tests/ui/union | |
| parent | 982b49494e7a50adb94eae42144cfa51229ac127 (diff) | |
| download | rust-26f48b4cba17a6f7d321bccaa86b345596923763.tar.gz rust-26f48b4cba17a6f7d321bccaa86b345596923763.zip | |
Stabilize THIR unsafeck
Diffstat (limited to 'tests/ui/union')
| -rw-r--r-- | tests/ui/union/union-unsafe.stderr | 12 | ||||
| -rw-r--r-- | tests/ui/union/union-unsized.stderr | 14 |
2 files changed, 7 insertions, 19 deletions
diff --git a/tests/ui/union/union-unsafe.stderr b/tests/ui/union/union-unsafe.stderr index 4d3408a89af..82b3f897167 100644 --- a/tests/ui/union/union-unsafe.stderr +++ b/tests/ui/union/union-unsafe.stderr @@ -1,8 +1,8 @@ error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-unsafe.rs:31:5 + --> $DIR/union-unsafe.rs:31:6 | LL | *(u.p) = 13; - | ^^^^^^^^^^^ access to union field + | ^^^^^ access to union field | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior @@ -39,18 +39,18 @@ LL | let U1 { a } = u1; = 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:61:12 + --> $DIR/union-unsafe.rs:61:20 | LL | if let U1 { a: 12 } = u1 {} - | ^^^^^^^^^^^^ access to union field + | ^^ 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:62:12 + --> $DIR/union-unsafe.rs:62:25 | LL | if let Some(U1 { a: 13 }) = Some(u1) {} - | ^^^^^^^^^^^^^^^^^^ access to union field + | ^^ access to union field | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior diff --git a/tests/ui/union/union-unsized.stderr b/tests/ui/union/union-unsized.stderr index 3d2e699f630..851ad8939d4 100644 --- a/tests/ui/union/union-unsized.stderr +++ b/tests/ui/union/union-unsized.stderr @@ -17,7 +17,7 @@ LL | a: Box<str>, | ++++ + error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union - --> $DIR/union-unsized.rs:5:5 + --> $DIR/union-unsized.rs:2:5 | LL | a: str, | ^^^^^^ @@ -47,18 +47,6 @@ LL | b: Box<str>, | ++++ + error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union - --> $DIR/union-unsized.rs:2:5 - | -LL | a: str, - | ^^^^^^ - | - = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` -help: wrap the field type in `ManuallyDrop<...>` - | -LL | a: std::mem::ManuallyDrop<str>, - | +++++++++++++++++++++++ + - -error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union --> $DIR/union-unsized.rs:11:5 | LL | b: str, |
