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

Conversation

@michaelsproul
Copy link
Contributor

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

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Apr 30, 2015

r? @Aatch

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

@michaelsproul

This comment has been minimized.

Copy link
Contributor Author

commented Apr 30, 2015

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

This comment has been minimized.

Copy link
Contributor Author

commented Apr 30, 2015

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

This comment has been minimized.

Copy link
Member

commented Apr 30, 2015

@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

This comment has been minimized.

Copy link
Contributor Author

commented Apr 30, 2015

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

@pnkfelix

This comment has been minimized.

Copy link
Member

commented Apr 30, 2015

@bors r+ 63e6321 rollup

bors added a commit that referenced this pull request Apr 30, 2015
Auto merge of #24975 - michaelsproul:enum-diagnostics, r=pnkfelix
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

This comment has been minimized.

Copy link
Contributor

commented Apr 30, 2015

⌛️ Testing commit 63e6321 with merge e962870...

@bors bors merged commit 63e6321 into rust-lang:master Apr 30, 2015

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@michaelsproul michaelsproul deleted the michaelsproul:enum-diagnostics branch Apr 30, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.