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

lint unportable clike enum discriminants #710

Merged
merged 1 commit into from
Feb 29, 2016
Merged

lint unportable clike enum discriminants #710

merged 1 commit into from
Feb 29, 2016

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Feb 26, 2016

some context here: rust-lang/rust#24290

in case 16-bit targets become a thing, we should adjust the lint.

/// **Example:** #[repr(usize)] enum NonPortable { X = 0x1_0000_0000, Y = 0 }
declare_lint! {
pub ENUM_CLIKE_UNPORTABLE_VARIANT, Warn,
"finds enums where all variants share a prefix/postfix"
Copy link
Member

Choose a reason for hiding this comment

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

the description is wrong

Copy link
Contributor Author

Choose a reason for hiding this comment

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

copypasta

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@oli-obk
Copy link
Contributor Author

oli-obk commented Feb 26, 2016

addressed comments

use rustc::middle::ty;
use utils::span_lint;

/// **What it does:** C-like enums that are `repr(isize/usize)`` and have values that don't fit into an `i32`
Copy link
Member

Choose a reason for hiding this comment

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

There is one quote to many after repr(isize/usize) and other wiki entries end with a point 😄

@oli-obk
Copy link
Contributor Author

oli-obk commented Feb 26, 2016

addressed comments

@oli-obk
Copy link
Contributor Author

oli-obk commented Feb 29, 2016

rebased

llogiq added a commit that referenced this pull request Feb 29, 2016
lint unportable clike enum discriminants
@llogiq llogiq merged commit 35e00e2 into rust-lang:master Feb 29, 2016
@llogiq
Copy link
Contributor

llogiq commented Feb 29, 2016

Thanks! 👍

@oli-obk oli-obk deleted the enum_disrc_portability branch February 29, 2016 10:46
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.

4 participants