inline_const_as_literal drops the type suffix when inlining a typed numeric constant. the resulting bare literal has an ambiguous numeric type causing E0689 when its used as the receiver of a method call that requires a concrete type.
reproduce:
const BASE: i32 = 24i32;
fn main() { let result = BASE.wrapping_add(7i32); }
expected (type suffix preserved. code compiles):
fn main() { let result = 24i32.wrapping_add(7i32); }
actual (type suffix dropped. code dosent compile):
fn main() { let result = 24.wrapping_add(7i32); }
24 is now {integer} — type inference cannot resolve it as the method receiver. rustc gives:
error[E0689]: can't call method `wrapping_add` on ambiguous numeric type `{integer}`
env:
- rustc: 1.94.0
- rust-analyzer: 0.3.2854
- OS: Ubuntu
- Editor: VS Code
inline_const_as_literaldrops the type suffix when inlining a typed numeric constant. the resulting bare literal has an ambiguous numeric type causing E0689 when its used as the receiver of a method call that requires a concrete type.reproduce:
expected (type suffix preserved. code compiles):
actual (type suffix dropped. code dosent compile):
24is now{integer}— type inference cannot resolve it as the method receiver.rustcgives:env: