-
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
a couple more error explanations for posterity #43519
a couple more error explanations for posterity #43519
Conversation
c7fc4c0
to
e8cb201
Compare
src/librustc_borrowck/diagnostics.rs
Outdated
@@ -1132,6 +1132,22 @@ fn main() { | |||
``` | |||
"##, | |||
|
|||
E0595: r##" | |||
Closures cannot mutate immutable captured variables. Erroneous code example: |
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.
Please put "Erroneous code example:" on its own line.
src/librustc_typeck/diagnostics.rs
Outdated
E0436: r##" | ||
The functional record update syntax is only allowed for structs. (Struct-like | ||
enum variants don't qualify.) | ||
|
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.
Please add "Erroneous code example:".
src/librustc_typeck/diagnostics.rs
Outdated
@@ -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: |
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.
Please remove "For example:" and add "Erroneous code example:".
src/librustc_typeck/diagnostics.rs
Outdated
days: (1, 15), annual_special: false | ||
}, | ||
c @ PublicationFrequency::SemiMonthly{ .. } => PublicationFrequency::SemiMonthly { | ||
annual_special: true, ..c // error: functional record update syntax requires 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.
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
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.)
e8cb201
to
7dab981
Compare
(force-pushed) |
Ok, sounds good to me. Thanks! @bors: r+ rollup |
📌 Commit 7dab981 has been approved by |
…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
☀️ Test successful - status-appveyor, status-travis |
E0436, E0595, and moving E0569 to where it belongs in the file rather than being bizarrely out of numerical order
r? @GuillaumeGomez