-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Tracking issue for RFC 2438, "Deny the overflowing_literals
lint for the 2018 edition"
#54502
Comments
Marked as P-high for T-compiler due to edition 2018. |
@nikomatsakis Do we have a mechanism for per-edition default lint levels? |
Yes we do. We should just be able to replace: declare_lint! {
OVERFLOWING_LITERALS,
Warn,
"literal out of range for its type",
Edition::Edition2018 => Deny
} |
Is there any reason it can't be made deny by default in the 2015 edition as well? |
Documentation is still todo |
triaged at T-compiler meeting. assigning to self to resolve doc issue(s). |
discussed with @Centril last night, mainly to find out what sort of documentation they expect to see here. It sounds like they would be satisfied with some sort of note in the Guide for the 2018 Edition... |
Note that, as far as I can tell, there is no such documentation for any of the other lints whose default level depends on the edition, so if |
Following up on @varkor's point: While initiating an attempt to write the documentation, I tried to find any discussion of lints in "The Rust Programming Language" second edition. By this I mean "the linting system as a whole", or even "any particular lint." E.g. discussion or introduction of Maybe my search terms were ill-chosen, but I couldn't find any discussion of lints. I'm not really inclined to spend time trying to document the changes to the default values (apart from e.g. the release notes) without having some documentation in a url-referable place that discusses the lint system as as whole. |
The decision of what to do at this point is probably best laid in the hands of the docs team, not the compiler team. So I'm unassigning myself, reassigning the issue to the docs team, and tagging with I-nominated to try to promote its discussion amongst the docs team.
|
Lints are currently in the rustc book.
… On Sep 28, 2018, at 8:59 AM, Felix S Klock II ***@***.***> wrote:
The decision of what to do at this point is probably best laid in the hands of the docs team, not the compiler team.
So I'm unassigning myself, reassigning the issue to the docs team, and tagging with I-nominated to try to promote its discussion amongst that team.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Well I couldn't find any reason for it to only be deny by default on the 2018 edition so I've submitted #55632 to make it deny by default on all editions. |
Only rust-lang/edition-guide#146 remains now that #55632 is merged; closing therefore. |
This broke some of my doc test code in inkwell while updating to 2018e which looked like this: It was used as an example as to how sign extended bitshifting works. I don't really understand why this isn't valid. For example, looking at an even simpler example: error: literal out of range for i8
--> src/main.rs:2:14
|
2 | let _x = 0b1110_0000i8;
| ^^^^^^^^^^^^^ help: consider using `u8` instead: `0b1110_0000u8`
|
= note: #[deny(overflowing_literals)] on by default
= note: the literal `0b1110_0000i8` (decimal `224`) does not fit into an `i8` and will become `-32i8` However, it is my intent to specify the bit representation of an |
Rust's literals are not the bit representation of the final value. If they were, you'd get different result depending on whether you are on a big endian or a little endian machine (ok not for Instead the binary literals are the canonical binary representation of a positive integer, just like decimal literals are the canonical decimal representation of a positive integer. If you write |
I guess that makes sense, thanks for explaining. But it's certainly surprising behavior |
This is a tracking issue for the RFC "Deny the
overflowing_literals
lint for the 2018 edition" (rust-lang/rfcs#2438).Steps:
Unresolved questions:
None
The text was updated successfully, but these errors were encountered: