On Sat Oct 3, 2026 at 1:59 AM JST, Miguel Ojeda wrote: <...> > One thing before that, though: are these assertions expected to fail? > > const X: i64 = 1 << 31; > const Y: i64 = cv!(1 << 31); > assert_eq!(X, Y); > > Or: > > const X: u64 = 2 << 31; > const Y: u64 = cv!(2 << 31); > assert_eq!(X, Y);
I have tested and both fail indeed. However they pass if the `cv!` literal is annotated with the correct type (e.g. `cv!(1i64 << 31)`). > > Because that is quite surprising, especially since we say "with the > target type inferred from the context" in the documentation. The target type is indeed inferred, but the expression is typed by itself, so unsuffixed literals default to `i32` as they would in a `let` statement without annotation. That limitation is inherent to the design widening to `i128` I am afraid. I don't know if that's a blocker, but if not, we should probably have a `Pitfalls` section to mention that explicitly.
