Closed
Description
The new trivial_numeric_casts
lint incorrectly warns when casting between two types that happen to be type aliases. This is incorrect because the types may not actually be type aliases under all build configurations. Case in point, libc::c_long
is i32
on some architectures and i64
on others. If I believe the trivial_numeric_casts
warning when casting from an i64
to a libc::c_long
, that breaks compilation on 32-bit architectures.
#![feature(libc)]
extern crate libc;
fn main() {
let x: i64 = 1;
let _y = x as libc::c_long;
// ^~~~~~~~~~~~~~~~~
// warning: trivial numeric cast: `i64` as `i64`, #[warn(trivial_numeric_casts)] on by default
}