mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-02 18:27:37 +00:00

When looking for the field names and types of a given type, account for tuples. This allows suggestions for incorrectly nested field accesses and field name typos to trigger as intended. Previously these suggestions only worked on `ty::Adt`, including tuple structs which are no different to tuples, so they should behave the same in suggestions. ``` error[E0599]: no method named `get_ref` found for tuple `(BufReader<File>,)` in the current scope --> $DIR/missing-field-access.rs:11:15 | LL | let x = f.get_ref(); | ^^^^^^^ method not found in `(BufReader<File>,)` | help: one of the expressions' fields has a method of the same name | LL | let x = f.0.get_ref(); | ++ ```
27 lines
998 B
Plaintext
27 lines
998 B
Plaintext
error[E0609]: no field `ab` on type `(Box<(dyn Fn(Option<A>) -> Option<B> + 'static)>, Box<(dyn Fn(Option<B>) -> Option<A> + 'static)>)`
|
|
--> $DIR/well-formed-recursion-limit.rs:12:23
|
|
|
|
|
LL | let (ab, ba) = (i.ab, i.ba);
|
|
| ^^ unknown field
|
|
|
|
|
= note: available fields are: `0`, `1`
|
|
|
|
error[E0609]: no field `ba` on type `(Box<(dyn Fn(Option<A>) -> Option<B> + 'static)>, Box<(dyn Fn(Option<B>) -> Option<A> + 'static)>)`
|
|
--> $DIR/well-formed-recursion-limit.rs:12:29
|
|
|
|
|
LL | let (ab, ba) = (i.ab, i.ba);
|
|
| ^^ unknown field
|
|
|
|
|
= note: available fields are: `0`, `1`
|
|
|
|
error[E0275]: overflow assigning `_` to `Option<_>`
|
|
--> $DIR/well-formed-recursion-limit.rs:15:33
|
|
|
|
|
LL | let left = move |o_a| match o_a {
|
|
| ^^^
|
|
|
|
error: aborting due to 3 previous errors
|
|
|
|
Some errors have detailed explanations: E0275, E0609.
|
|
For more information about an error, try `rustc --explain E0275`.
|