3 ms·
In addition to what the others said about this not working you can get this to work by providing a conversion to either of the calls, so this works: fn foo32
by irishsultan 9y ago
In addition to what the others said about this not working you can get this to work by providing a conversion to either of the calls, so this works:
fn foo32(x: f32) { println!("{}", x); }
fn foo64(x: f64) { println!("{}", x); }
fn bar64() {
let x = 5.0; // f64
foo64(x);
foo32(x as f32);
}
fn bar32() {
let x = 5.0; // f32, not f64
foo32(x);
foo64(x as f64);
}