-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Add context to E0084, E0517, E0518 #45984
Conversation
Show both the attribute and the item
|
||
#[repr(C)] | ||
enum EExtern { A, B } | ||
|
||
#[repr(align(8))] //~ ERROR: attribute should be applied to struct | ||
enum EAlign { A, B } | ||
enum EAlign { A, B } // not a struct | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, just noticed these are missing tildes (but the test still passes?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
surveying nearby examples it seems I simply shouldn't include the "note" messages in this test anyways? (we just want to know that the error is triggered here?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ExpHP if you run build/<ENV>/stage1/bin/rustc src/test/compile-fail/attr-usage-repr.rs
you will see the actual output. The test as it was previously was incorrect, as it wasn't asserting the label in that line. It should have been a //~ NOTE: not a struct
there. Please change it here and elsewhere to avoid regressions and actually test this change.
r=me after replacing all the |
Before
After
(In color)Saved terminal output with ansi escape sequences: $ # before
$ curl -s https://gist.githubusercontent.com/ExpHP/31fda7073c66462f633219a87e14c99a/raw/8cb74221ca2e7f0f138e85931541f1c754d81ffd/before-ansi
$ # after
$ curl -s https://gist.githubusercontent.com/ExpHP/88beefb1d1dfe8cbd21ad8883358b438/raw/95143504316b7dfe0c3c17f50684352546f99cf1/examples-ansi |
@bors r+ rollup |
📌 Commit ead9ac3 has been approved by |
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
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 #45886