Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E0084 and E0517 should show both repr attribute and struct #45886

Closed
Havvy opened this issue Nov 9, 2017 · 2 comments
Closed

E0084 and E0517 should show both repr attribute and struct #45886

Havvy opened this issue Nov 9, 2017 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@Havvy
Copy link
Contributor

Havvy commented Nov 9, 2017

You can trigger both errors by using #[repr(packed)] on an enum with no variants.

#[repr(packed)]
enum Void {}

The errors given out are:

   Compiling playground v0.0.1 (file:///playground)
error[E0517]: attribute should be applied to struct or union
 --> src/main.rs:1:1
  |
1 | #[repr(packed)]
  | ^^^^^^^^^^^^^^^ requires a struct or union

error[E0084]: unsupported representation for zero-variant enum
 --> src/main.rs:2:1
  |
2 | enum Void {}
  | ^^^^^^^^^^^^ unsupported enum representation

error: aborting due to 2 previous errors

error: Could not compile `playground`.

To learn more, run the command again with --verbose.

E0517 shows the attribute, but does not show the enum. E0084 shows the enum, but does not show the attribute. Both errors should show both.

@QuietMisdreavus QuietMisdreavus added A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Nov 9, 2017
@ExpHP
Copy link
Contributor

ExpHP commented Nov 13, 2017

This looks simple enough. I tentatively call dibs, if I may, assuming I don't mysteriously vanish or spontaneously combust or something

@ExpHP
Copy link
Contributor

ExpHP commented Nov 14, 2017

also taking care of E0518 (#[inline] on types and impls) which is handled right next to E0517

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Nov 16, 2017
Add context to E0084, E0517, E0518

A small diagnostic enhancement to get my feet wet.  Please scrutinize!

This modifies errors E0084, E0517, and E0518 to include both the annotation and the annotated item.  All of these errors already had labels; I moved the label to the other span, and rephrased it as necessary.

Fixes rust-lang#45886
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

3 participants