gccrs icon indicating copy to clipboard operation
gccrs copied to clipboard

Tuple indices are handled with their shorthand

Open P-E-P opened this issue 2 years ago • 0 comments

Using index 0001 on an tuple should emit an error

I tried this code:

fn main() {
    (1, (2, 3)).0001.0001;
}

I expected to see this happen: Emit an error.

error[E0609]: no field `0001` on type `Toto`
 --> src/main.rs:7:18
  |
7 |     let _ = toto.0001.001;
  |                  ^^^^ unknown field

Instead, this happened: The 0001 is replaced by a single 1, all leading zeroes are discarded and the code compiles correctly.

Meta

  • c6c92e8ef0f2a7ce3d2914d5b9657ce67ea00ceb

This behavior has been highlighted by #2694

P-E-P avatar Oct 17 '23 11:10 P-E-P