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

a couple more error explanations for posterity #43519

Merged
merged 3 commits into from
Jul 31, 2017

Conversation

zackmdavis
Copy link
Member

E0436, E0595, and moving E0569 to where it belongs in the file rather than being bizarrely out of numerical order

r? @GuillaumeGomez

@@ -1132,6 +1132,22 @@ fn main() {
```
"##,

E0595: r##"
Closures cannot mutate immutable captured variables. Erroneous code example:
Copy link
Member

Choose a reason for hiding this comment

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

Please put "Erroneous code example:" on its own line.

E0436: r##"
The functional record update syntax is only allowed for structs. (Struct-like
enum variants don't qualify.)

Copy link
Member

Choose a reason for hiding this comment

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

Please add "Erroneous code example:".

@@ -3926,6 +3949,26 @@ See [RFC 1522] for more details.
[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md
"##,

E0569: r##"
If an impl has a generic parameter with the `#[may_dangle]` attribute, then
that impl must be declared as an `unsafe impl. For example:
Copy link
Member

Choose a reason for hiding this comment

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

Please remove "For example:" and add "Erroneous code example:".

days: (1, 15), annual_special: false
},
c @ PublicationFrequency::SemiMonthly{ .. } => PublicationFrequency::SemiMonthly {
annual_special: true, ..c // error: functional record update syntax requires a struct
Copy link
Member

Choose a reason for hiding this comment

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

This line is too long.

[00:11:18] error: description for error code E0436 contains a line longer than 80 characters.
[00:11:18] if you're inserting a long URL use the footnote style to bypass this check.
[00:11:18]     --> /checkout/src/librustc_typeck/diagnostics.rs:13:1
[00:11:18]      |
[00:11:18] 13   | / register_long_diagnostics! {
[00:11:18] 14   | |
[00:11:18] 15   | | E0023: r##"
[00:11:18] 16   | | A pattern used to match against an enum variant must provide a sub-pattern for
[00:11:18] ...    |
[00:11:18] 4637 | |
[00:11:18] 4638 | | }
[00:11:18]      | |_^
[00:11:18]      |
[00:11:18]      = note: this error originates in a macro outside of the current crate

@shepmaster shepmaster added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 28, 2017
This example focuses on struct-like enum variants, because it's not
immediately obvious in what other context we can get E0436 alone,
without any other, more serious, errors. (Triggering E0436 with a union
also emits a separate "union expressions should have exactly one field"
error.)

(One might argue that we ought to accept the functional record update
syntax for struct-like enums, but that is beyond the scope of this
error-index-comprehensiveness commit.)
We want the error explanations to appear in numerical order so that
they're easy to find. (Also, any other order would be arbitrary and thus
not constitute a Schelling point.) Bizarrely, the extended information
for E0569 was placed between E0244 and E0318 in
librustc_typeck/diagnostics.rs (when the code was introduced in
9a649c3). This commit moves it to be between E0562 and E0570, where it
belongs.

(Also, at reviewer request, say "Erroneous code example", the standard
verbiage that it has been decided that we say everywhere.)
@zackmdavis
Copy link
Member Author

(force-pushed)

@GuillaumeGomez
Copy link
Member

Ok, sounds good to me. Thanks!

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Jul 30, 2017

📌 Commit 7dab981 has been approved by GuillaumeGomez

@bors
Copy link
Contributor

bors commented Jul 31, 2017

⌛ Testing commit 7dab981 with merge 2789db2...

bors added a commit that referenced this pull request Jul 31, 2017
…laumeGomez

a couple more error explanations for posterity

E0436, E0595, and moving E0569 to where it belongs in the file rather than being bizarrely out of numerical order

r? @GuillaumeGomez
@bors
Copy link
Contributor

bors commented Jul 31, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: GuillaumeGomez
Pushing 2789db2 to master...

@bors bors merged commit 7dab981 into rust-lang:master Jul 31, 2017
@zackmdavis zackmdavis deleted the long_diagnostics_ever_after branch January 13, 2018 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants