-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix ICE in decimal_literal_representation lint #3931
Conversation
Handling the integer parsing properly instead of just unwrapping. Note that the test is not catching the ICE because plain UI tests [currently hide ICEs][compiletest_issue]. Once that issue is fixed, this test would fail properly again. [compiletest_issue]: Manishearth/compiletest-rs#169
For some reason rustfmt is triggering the same rust warning: https://travis-ci.com/rust-lang/rust-clippy/jobs/191281098#L1664 |
Maybe use the old hack and exclude the test file here: Line 62 in 949f584
|
Because the code triggers a rustc parse error which makes rustfmt fail.
I re-added the old hack to exclude the file from rustfmt. I think in this specific case it makes sense to be excluded. |
One last thing: All these if_chain! {
if let LitKind::Int(..) = lit.node;
if let Some(src) = snippet_opt(cx, lit.span);
if let Some(firstch) = src.chars().next();
if char::to_digit(firstch, 10).is_some();
let digit_info = DigitInfo::new(&src, false);
if digit_info.radix == Radix::Decimal;
if let Ok(val) = digit_info.digits;
if val >= u128::from(self.threshold);
then {
let hex = format!("{:#X}", val);
let digit_info = DigitInfo::new(&hex, false);
let _ = Self::do_lint(digit_info.digits).map_err(|warning_type| {
warning_type.display(&digit_info.grouping_hint(), cx, lit.span)
});
}
} (For some reason I wasn't able to comment directly on the code) |
Yup, that worked =) |
@bors r+ |
📌 Commit ab6b949 has been approved by |
Fix ICE in decimal_literal_representation lint Handling the integer parsing properly instead of just unwrapping. Note that the test is not catching the ICE because plain UI tests [currently hide ICEs][compiletest_issue]. Once that issue is fixed, this test would fail properly again. Fixes #3891 [compiletest_issue]: Manishearth/compiletest-rs#169
☀️ Test successful - checks-travis, status-appveyor |
Handling the integer parsing properly instead of just unwrapping.
Note that the test is not catching the ICE because plain UI tests
currently hide ICEs. Once that issue is fixed, this
test would fail properly again.
Fixes #3891