//@ run-rustfix // The `try_into` suggestion doesn't include this, but we do suggest it after applying it use std::convert::TryInto; fn foo(_x: N) {} fn main() { let x_usize: usize = 1; let x_u64: u64 = 2; let x_u32: u32 = 3; let x_u16: u16 = 4; let x_u8: u8 = 5; let x_isize: isize = 6; let x_i64: i64 = 7; let x_i32: i32 = 8; let x_i16: i16 = 9; let x_i8: i8 = 10; let x_f64: f64 = 11.0; let x_f32: f32 = 12.0; foo::(x_usize); foo::(x_u64.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u32.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u16.into()); //~^ ERROR mismatched types foo::(x_u8.into()); //~^ ERROR mismatched types foo::(x_isize.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i64.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i32.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i16.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i8.try_into().unwrap()); //~^ ERROR mismatched types // foo::(x_f64); // foo::(x_f32); foo::(x_usize.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u64.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u32.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u16.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u8.into()); //~^ ERROR mismatched types foo::(x_isize); foo::(x_i64.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i32.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i16.into()); //~^ ERROR mismatched types foo::(x_i8.into()); //~^ ERROR mismatched types // foo::(x_f64); // foo::(x_f32); foo::(x_usize.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u64); foo::(x_u32.into()); //~^ ERROR mismatched types foo::(x_u16.into()); //~^ ERROR mismatched types foo::(x_u8.into()); //~^ ERROR mismatched types foo::(x_isize.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i64.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i32.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i16.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i8.try_into().unwrap()); //~^ ERROR mismatched types // foo::(x_f64); // foo::(x_f32); foo::(x_usize.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u64.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u32.into()); //~^ ERROR mismatched types foo::(x_u16.into()); //~^ ERROR mismatched types foo::(x_u8.into()); //~^ ERROR mismatched types foo::(x_isize.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i64); foo::(x_i32.into()); //~^ ERROR mismatched types foo::(x_i16.into()); //~^ ERROR mismatched types foo::(x_i8.into()); //~^ ERROR mismatched types // foo::(x_f64); // foo::(x_f32); foo::(x_usize.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u64.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u32); foo::(x_u16.into()); //~^ ERROR mismatched types foo::(x_u8.into()); //~^ ERROR mismatched types foo::(x_isize.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i64.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i32.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i16.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i8.try_into().unwrap()); //~^ ERROR mismatched types // foo::(x_f64); // foo::(x_f32); foo::(x_usize.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u64.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u32.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u16.into()); //~^ ERROR mismatched types foo::(x_u8.into()); //~^ ERROR mismatched types foo::(x_isize.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i64.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i32); foo::(x_i16.into()); //~^ ERROR mismatched types foo::(x_i8.into()); //~^ ERROR mismatched types // foo::(x_f64); // foo::(x_f32); foo::(x_usize.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u64.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u32.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u16); foo::(x_u8.into()); //~^ ERROR mismatched types foo::(x_isize.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i64.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i32.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i16.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i8.try_into().unwrap()); //~^ ERROR mismatched types // foo::(x_f64); // foo::(x_f32); foo::(x_usize.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u64.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u32.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u16.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u8.into()); //~^ ERROR mismatched types foo::(x_isize.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i64.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i32.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i16); foo::(x_i8.into()); //~^ ERROR mismatched types // foo::(x_f64); // foo::(x_f32); foo::(x_usize.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u64.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u32.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u16.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u8); foo::(x_isize.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i64.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i32.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i16.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i8.try_into().unwrap()); //~^ ERROR mismatched types // foo::(x_f64); // foo::(x_f32); foo::(x_usize.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u64.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u32.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u16.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_u8.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_isize.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i64.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i32.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i16.try_into().unwrap()); //~^ ERROR mismatched types foo::(x_i8); // foo::(x_f64); // foo::(x_f32); foo::(x_usize as f64); //~^ ERROR mismatched types foo::(x_u64 as f64); //~^ ERROR mismatched types foo::(x_u32.into()); //~^ ERROR mismatched types foo::(x_u16.into()); //~^ ERROR mismatched types foo::(x_u8.into()); //~^ ERROR mismatched types foo::(x_isize as f64); //~^ ERROR mismatched types foo::(x_i64 as f64); //~^ ERROR mismatched types foo::(x_i32.into()); //~^ ERROR mismatched types foo::(x_i16.into()); //~^ ERROR mismatched types foo::(x_i8.into()); //~^ ERROR mismatched types foo::(x_f64); foo::(x_f32.into()); //~^ ERROR mismatched types foo::(x_usize as f32); //~^ ERROR mismatched types foo::(x_u64 as f32); //~^ ERROR mismatched types foo::(x_u32 as f32); //~^ ERROR mismatched types foo::(x_u16.into()); //~^ ERROR mismatched types foo::(x_u8.into()); //~^ ERROR mismatched types foo::(x_isize as f32); //~^ ERROR mismatched types foo::(x_i64 as f32); //~^ ERROR mismatched types foo::(x_i32 as f32); //~^ ERROR mismatched types foo::(x_i16.into()); //~^ ERROR mismatched types foo::(x_i8.into()); //~^ ERROR mismatched types // foo::(x_f64); foo::(x_f32); foo::((x_u8 as u16).into()); //~^ ERROR mismatched types foo::((-x_i8).into()); //~^ ERROR mismatched types }