Closed
Description
Rust errors have improved a lot in this direction over the past year, but this would make it even easier to code without having to look for struct field names in the documentation:
#[derive(Default)]
struct A { a: (), b: (), c:(), d: (), e: () }
fn main() {
let a = A::default();
let b = a.z;
}
At the moment, rustc reports "did you mean a
?". It would be more convenient to report "no such field. Available fields are: a, b, c, d, e".
In a codebase in a "prototyping stage", it can be the case that several types have similar field names. Listing the fields would even make it easier to refactor, by highlighting similarities.