-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 error codes in libsyntax #34531
Add error codes in libsyntax #34531
Conversation
3b92de8
to
0e326d4
Compare
struct_span_err!(diag, attr.span, E0533, | ||
"export_name attribute has invalid format") | ||
.help("use #[export_name=\"*\"]") | ||
.emit(); |
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.
Is this the recommended indentation? This makes it harder to read imho
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.
Hard to say. I prefer like that but if people don't like it, I'll change it (whatever the new way is).
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.
The previous format is fine. At some point, we'll probably switch to rustfmt and just use that, but for now we can keep it how it was.
I left a couple comments. Mostly seems okay, but the diagnostics needs a better list. Once that's fixed, I'm fine with r=me. |
5cc339b
to
2d6d7b6
Compare
@jonathandturner: I didn't change the indent (mostly because I don't which one I should use). If someone else agrees with you, I'll update. @bors: r=jonathandturner |
📌 Commit 2d6d7b6 has been approved by |
This failed test looks like it was caused by this PR and might be legit: https://buildbot.rust-lang.org/builders/auto-win-gnu-64-opt/builds/4710. |
It seems so. |
2d6d7b6
to
84e874f
Compare
@bors: r=jonathandturner |
📌 Commit 84e874f has been approved by |
⌛ Testing commit 84e874f with merge fd75c98... |
💔 Test failed - auto-win-msvc-64-opt-rustbuild |
@bors: retry On Fri, Jul 1, 2016 at 5:46 AM, bors [email protected] wrote:
|
⌛ Testing commit 84e874f with merge 77e7aed... |
💔 Test failed - auto-win-gnu-32-opt-rustbuild |
@bors: retry On Fri, Jul 1, 2016 at 12:48 PM, bors [email protected] wrote:
|
… r=jonathandturner Add error codes in libsyntax r? @jonathandturner Fixes rust-lang#34526
MultipleStabilityLevels, | ||
} | ||
|
||
fn handle_errors(diag: &Handler, span: Span, error: AttrError) { |
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.
This PR was 6 years ahead of its time :)
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.
:)
Eliminate rustc_attrs::builtin::handle_errors in favor of emitting errors directly Suggested in rust-lang#116773 (review). This `handle_errors` function is originally from rust-lang#34531, in which it was useful because it allowed error messages and error codes (`E0542`) for multiple occurrences of the same error to be centralized in one place. For example rather than repeating this diagnostic in 2 places: ```rust span_err!(diagnostic, attr.span, E0542, "missing 'since'"); ``` one could repeat this instead: ```rust handle_errors(diagnostic, attr.span, AttrError::MissingSince); ``` ensuring that all "missing 'since'" errors always remained consistent in message and error code. Over time as error messages and error codes got factored to fluent diagnostics (rust-lang#100836), this rationale no longer applies. The new code has the same benefit while being less verbose (+73, -128). ```rust sess.emit_err(session_diagnostics::MissingSince { span: attr.span }); ``` r? `@cjgillot`
Rollup merge of rust-lang#117064 - dtolnay:handleerrors, r=cjgillot Eliminate rustc_attrs::builtin::handle_errors in favor of emitting errors directly Suggested in rust-lang#116773 (review). This `handle_errors` function is originally from rust-lang#34531, in which it was useful because it allowed error messages and error codes (`E0542`) for multiple occurrences of the same error to be centralized in one place. For example rather than repeating this diagnostic in 2 places: ```rust span_err!(diagnostic, attr.span, E0542, "missing 'since'"); ``` one could repeat this instead: ```rust handle_errors(diagnostic, attr.span, AttrError::MissingSince); ``` ensuring that all "missing 'since'" errors always remained consistent in message and error code. Over time as error messages and error codes got factored to fluent diagnostics (rust-lang#100836), this rationale no longer applies. The new code has the same benefit while being less verbose (+73, -128). ```rust sess.emit_err(session_diagnostics::MissingSince { span: attr.span }); ``` r? `@cjgillot`
r? @jonathandturner
Fixes #34526