blob: ad428edec7273cd6029b90da9b5981c81d1daed3 [file]
//@ build-pass
#![feature(f16, f32_from_f16)]
#![allow(unused)]
// Check that float conversions work, specifically a {float} literal that normally would fall back
// to an f64 but due to the Into bound here falls back to f32. Also test that the lint is emitted in
// the correct location, and can be `expect`ed or `allow`ed.
fn convert(x: impl Into<f32>) -> f32 {
x.into()
}
pub fn main() {
let _ = convert(1.0f32);
let _ = convert(1.0f16);
#[expect(float_literal_f32_fallback)]
let _ = convert(1.0);
}