Indexing tuple warning misleading
2f4ff27
Opened by gnzlbg at
The following rust snippet:
fn main() {
let x = (0u32, 1u64, 2isize);
for i in 0..3 {
println!("{}\n", x[i]);
// ERROR: to access tuple elements,
// use tuple indexing syntax (e.g. `tuple.0`)
// println!("{}\n", x.i); // This doesn't obviously work
}
}
produces a warning that recommends using .0 to index the tuple, but what it should recommend is to match on the index.
Current output:
error[E0608]: cannot index into a value of type `(u32, u64, isize)` --> src/main.rs:4:24 | 4 | println!("{}\n", x[i]); | ^^^^ | = help: to access tuple elements, use tuple indexing syntax (e.g., `tuple.0`)Esteban Kuber at 2019-09-23 05:19:15