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 long diagnostics for enum repr errors. #24975

Merged
merged 1 commit into from
Apr 30, 2015
Merged

Add long diagnostics for enum repr errors. #24975

merged 1 commit into from
Apr 30, 2015

Conversation

michaelsproul
Copy link
Contributor

Explanations for E0079, E0080, E0081, E0082, E0083 and E0084 as part of #24407.

All the errors concern the use of #[repr(X)] with enum types.

I also updated the short description for E0079 so that it takes sign into account.

@rust-highfive
Copy link
Collaborator

r? @Aatch

(rust_highfive has picked a reviewer for you, use r? to override)

@michaelsproul
Copy link
Contributor Author

Here's an example where the current error for E0079 is misleading.

#[repr(u8)]
enum Wow {
    X = "what",
    Y
}

fn main() {}
what.rs:3:9: 3:15 error: mismatched types:
 expected `u8`,
    found `&'static str`
(expected u8,
    found &-ptr) [E0308]
what.rs:3     X = "what",
                  ^~~~~~
what.rs:3:9: 3:15 error: expected signed integer constant [E0079]
what.rs:3     X = "what",
                  ^~~~~~
error: aborting due to 2 previous errors

Note the mention of signed integer constant.

@michaelsproul
Copy link
Contributor Author

make tidy is broken because of errorck.py, which was made redundant by the uniqueness checking I added in #24884.

I think errorck.py could be safely deleted unless someone has further plans for it? @brson?

@pnkfelix
Copy link
Member

@michaelsproul I think errorck.py still remains useful as a quick way to find the highest error code, no?

In the short term, maybe you could work around it by changing the text to say "error code 0082" .. though I can see how that is not ideal.

Nonetheless, I'm not 100% sure that referring users to another error code is really great practice... would it not be better to tell users to look up the #[repr(..)] attribute in the documentation?

@michaelsproul
Copy link
Contributor Author

@pnkfelix: You're absolutely right! I'll leave errock.py alone and change my explanation to point to the reference.

@pnkfelix
Copy link
Member

@bors r+ 63e6321 rollup

bors added a commit that referenced this pull request Apr 30, 2015
Explanations for E0079, E0080, E0081, E0082, E0083 and E0084 as part of #24407.

All the errors concern the use of `#[repr(X)]` with enum types.

I also updated the short description for E0079 so that it takes sign into account.
@bors
Copy link
Contributor

bors commented Apr 30, 2015

⌛ Testing commit 63e6321 with merge e962870...

@bors bors merged commit 63e6321 into rust-lang:master Apr 30, 2015
@michaelsproul michaelsproul deleted the enum-diagnostics branch April 30, 2015 23:22
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.

5 participants