Skip to content

Commit

Permalink
Auto merge of #8446 - ehuss:fix-usize-32, r=alexcrichton
Browse files Browse the repository at this point in the history
Fix overflow error on 32-bit.

This fails to compile on 32-bit platforms with an overflow error ("attempt to shift right by 32_i32 which would overflow").

I think it would be highly unlikely for any value to be in the billions.  Alternatively it can be rewritten to something like `assert!(val <= u32::MAX as usize);`.
  • Loading branch information
bors committed Jul 2, 2020
2 parents cf3bfc9 + fbee47a commit fede83c
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/cargo/core/compiler/fingerprint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1964,7 +1964,6 @@ impl EncodedDepInfo {
dst.push((val >> 8) as u8);
dst.push((val >> 16) as u8);
dst.push((val >> 24) as u8);
assert!(val >> 32 == 0);
}
}
}
Expand Down

0 comments on commit fede83c

Please sign in to comment.