Use a magic value other than 42
Shifting a literal (which is an int when a suffix is not present) generates a warning because the only possible result is 0, and the programmer probably didn't intend to do that. Change the shift to a value less than 32. The test exhibiting the warning wasn't aiming to test integer promotion rules, so I've opted to change the constant.
This commit is contained in:
committed by
Emilio Cobos Álvarez
parent
8a5662b4a7
commit
e8ff3f9b61
@@ -1,7 +1,7 @@
|
||||
pub const LEN: i32 = 42;
|
||||
pub const LEN: i32 = 22;
|
||||
|
||||
pub type NamedLenArray = [i32; LEN];
|
||||
pub type ValuedLenArray = [i32; 42];
|
||||
pub type ValuedLenArray = [i32; 22];
|
||||
|
||||
#[repr(u8)]
|
||||
pub enum AbsoluteFontWeight {
|
||||
@@ -14,7 +14,7 @@ pub enum AbsoluteFontWeight {
|
||||
pub extern "C" fn root(x: NamedLenArray, y: ValuedLenArray, z: AbsoluteFontWeight) { }
|
||||
|
||||
#[no_mangle]
|
||||
pub const X: i64 = 42 << 42;
|
||||
pub const X: i64 = 22 << 22;
|
||||
|
||||
#[no_mangle]
|
||||
pub const Y: i64 = X + X;
|
||||
|
||||
Reference in New Issue
Block a user