Why does the first code snippet fail with error error[E0599]: no method named abs found for type
{integer} in the current scope
:
let a = 3;
println!("{}", a.abs());
whereas, on specifying the type explicitly, this passes:
let a = 3_i32;
println!("{}", a.abs());
Isn't the default inferred type for numbers i32
as per this RFC? Then why are above two code snippets treated differently?