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

Add error codes in libsyntax #34531

Merged
merged 3 commits into from
Jul 2, 2016
Merged

Conversation

GuillaumeGomez
Copy link
Member

@GuillaumeGomez GuillaumeGomez commented Jun 28, 2016

struct_span_err!(diag, attr.span, E0533,
"export_name attribute has invalid format")
.help("use #[export_name=\"*\"]")
.emit();
Copy link
Contributor

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

Copy link
Member Author

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).

Copy link
Contributor

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.

@sophiajt
Copy link
Contributor

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.

@GuillaumeGomez GuillaumeGomez force-pushed the libsyntax_err_codes branch 2 times, most recently from 5cc339b to 2d6d7b6 Compare June 29, 2016 22:12
@GuillaumeGomez
Copy link
Member Author

@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

@bors
Copy link
Contributor

bors commented Jun 29, 2016

📌 Commit 2d6d7b6 has been approved by jonathandturner

@jseyfried
Copy link
Contributor

jseyfried commented Jun 30, 2016

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.

@GuillaumeGomez
Copy link
Member Author

It seems so.

bors added a commit that referenced this pull request Jun 30, 2016
Rollup of 5 pull requests

 - Successful merges: #34105, #34305, #34512, ~~#34531,~~ #34547
@GuillaumeGomez
Copy link
Member Author

@bors: r=jonathandturner

@bors
Copy link
Contributor

bors commented Jun 30, 2016

📌 Commit 84e874f has been approved by jonathandturner

@bors
Copy link
Contributor

bors commented Jul 1, 2016

⌛ Testing commit 84e874f with merge fd75c98...

@bors
Copy link
Contributor

bors commented Jul 1, 2016

💔 Test failed - auto-win-msvc-64-opt-rustbuild

@alexcrichton
Copy link
Member

@bors: retry

On Fri, Jul 1, 2016 at 5:46 AM, bors notifications@github.com wrote:

💔 Test failed - auto-win-msvc-64-opt-rustbuild
https://buildbot.rust-lang.org/builders/auto-win-msvc-64-opt-rustbuild/builds/1628


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#34531 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAD95HzihIH7zP0mT-WT1tfG01KOyHyLks5qRQwbgaJpZM4JAWlo
.

@bors
Copy link
Contributor

bors commented Jul 1, 2016

⌛ Testing commit 84e874f with merge 77e7aed...

@bors
Copy link
Contributor

bors commented Jul 1, 2016

💔 Test failed - auto-win-gnu-32-opt-rustbuild

@alexcrichton
Copy link
Member

@bors: retry

On Fri, Jul 1, 2016 at 12:48 PM, bors notifications@github.com wrote:

💔 Test failed - auto-win-gnu-32-opt-rustbuild
https://buildbot.rust-lang.org/builders/auto-win-gnu-32-opt-rustbuild/builds/1643


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#34531 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAD95JgN_O3JSbFNawRcwoHLCZ2Fs77mks5qRW7_gaJpZM4JAWlo
.

Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 2, 2016
bors added a commit that referenced this pull request Jul 2, 2016
Rollup of 7 pull requests

- Successful merges: #34531, #34545, #34551, #34566, #34567, #34574, #34583
- Failed merges:
@bors bors merged commit 84e874f into rust-lang:master Jul 2, 2016
@GuillaumeGomez GuillaumeGomez deleted the libsyntax_err_codes branch July 2, 2016 13:33
MultipleStabilityLevels,
}

fn handle_errors(diag: &Handler, span: Span, error: AttrError) {
Copy link
Member

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 :)

#117064

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 23, 2023
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`
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 23, 2023
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`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants