diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-07-22 10:04:37 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-07-25 10:30:43 +1000 |
| commit | 168c5b18392271abe6156350f0952e2b57fff9c5 (patch) | |
| tree | fd543c34e26f86ee82c8f470936e4c611a67dc00 /compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp | |
| parent | 29c5a028b0c92aa5da6a8eb6d6585a389fcf1035 (diff) | |
| download | rust-168c5b18392271abe6156350f0952e2b57fff9c5.tar.gz rust-168c5b18392271abe6156350f0952e2b57fff9c5.zip | |
Improve error messages involving `derive` and `packed`.
There are two errors involving `derive` and `packed`. ``` `#[derive]` can't be derived on a `#[repr(packed)]` struct with type or const parameters `#[derive]` can't be derived on a `#[repr(packed)]` struct that does not derive Copy ``` The second one overstates things. It is possible to use derive on a repr(packed) struct that doesn't derive Copy in two cases. - If all the fields within the struct meet the required alignment: 1 for `repr(packed)`, or `N` for `repr(packed(N))`. - If `Default` is the only trait derived. This commit improves things in a few ways. - Changes the errors to say `$TRAIT can't be derived on this ...`. This is more accurate, because it's just $TRAIT and *this* packed struct that are a problem, not *all* derived traits on *all* packed structs. - Adds more details to the "ERROR" lines in the test case, enough to distinguish between the two error messages. - Adds more cases to the test case that don't cause errors, e.g. `Default` derives. - Uses a wider variety of builtin traits in the test case, for better coverage.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
