8000 Add check for overlapping ranges to unreachable patterns lint by estebank · Pull Request #64007 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content
8000

Add check for overlapping ranges to unreachable patterns lint #64007

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

Merged
merged 10 commits into from
Oct 19, 2019
Prev Previous commit
Next Next commit
Silence lint in fit_signed and fit_unsigned
  • Loading branch information
estebank committed Oct 16, 2019
commit 916936c77488d0a75cc254b5bdc9a787c8ed8768
2 changes: 2 additions & 0 deletions src/librustc_target/abi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ impl Integer {

/// Finds the smallest Integer type which can represent the signed value.
pub fn fit_signed(x: i128) -> Integer {
#[cfg_attr(not(stage0), allow(overlapping_patterns))]
match x {
-0x0000_0000_0000_0080..=0x0000_0000_0000_007f => I8,
-0x0000_0000_0000_8000..=0x0000_0000_0000_7fff => I16,
Expand All @@ -499,6 +500,7 @@ impl Integer {

/// Finds the smallest Integer type which can represent the unsigned value.
pub fn fit_unsigned(x: u128) -> Integer {
#[cfg_attr(not(stage0), allow(overlapping_patterns))]
match x {
0..=0x0000_0000_0000_00ff => I8,
0..=0x0000_0000_0000_ffff => I16,
Expand Down
0