diff options
| author | Michael Goulet <michael@errs.io> | 2025-01-08 18:04:15 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-01-14 19:07:37 +0000 |
| commit | b89a6e49329f0813af07fa3f8472fb0333a8bc36 (patch) | |
| tree | 694a1df12dd3c1faf31dda364a458ba00059147c /tests/ui/enum-discriminant/eval-error.rs | |
| parent | 8c39ce5b4fb5b61796e5fd8cec56c7b9abd2122b (diff) | |
| download | rust-b89a6e49329f0813af07fa3f8472fb0333a8bc36.tar.gz rust-b89a6e49329f0813af07fa3f8472fb0333a8bc36.zip | |
Consider more erroneous layouts as LayoutError::ReferencesError to suppress spurious errors
Diffstat (limited to 'tests/ui/enum-discriminant/eval-error.rs')
| -rw-r--r-- | tests/ui/enum-discriminant/eval-error.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/ui/enum-discriminant/eval-error.rs b/tests/ui/enum-discriminant/eval-error.rs new file mode 100644 index 00000000000..f2c3b581627 --- /dev/null +++ b/tests/ui/enum-discriminant/eval-error.rs @@ -0,0 +1,37 @@ +union Foo { + a: str, + //~^ ERROR the size for values of type `str` cannot be known at compilation time + //~| ERROR field must implement `Copy` or be wrapped in `ManuallyDrop<...>` +} + +enum Bar { + Boo = { + let _: Option<Foo> = None; + 0 + }, +} + +union Foo2 {} +//~^ ERROR unions cannot have zero fields + +enum Bar2 { + Boo = { + let _: Option<Foo2> = None; + 0 + }, +} + +#[repr(u8, packed)] +//~^ ERROR attribute should be applied to a struct or union +enum Foo3 { + A +} + +enum Bar3 { + Boo = { + let _: Option<Foo3> = None; + 0 + }, +} + +fn main() {} |
