diff options
| author | Trevor Gross <t.gross35@gmail.com> | 2025-08-08 14:22:46 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-08 14:22:46 -0500 |
| commit | d47f8ade587c3a1204360305e6d7911a30c3a9cf (patch) | |
| tree | df6ceff07cdd9ddc894e1d58ff3e4a0e7e1f83a9 /tests/ui/consts | |
| parent | 804d1a194e8aafc4fbf3fc24250d77f2025f075e (diff) | |
| parent | eace82ca42ddffbbda8e2f34444e564ea375580d (diff) | |
| download | rust-d47f8ade587c3a1204360305e6d7911a30c3a9cf.tar.gz rust-d47f8ade587c3a1204360305e6d7911a30c3a9cf.zip | |
Rollup merge of #144649 - estebank:issue-144602, r=lcnr
Account for bare tuples and `Pin` methods in field searching logic 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. When suggesting field access which would encounter a method not found, do not suggest pinning when those methods are on `impl Pin` itself. ``` 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(); | ++ ``` instead of ``` 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: consider pinning the expression | LL ~ let mut pinned = std::pin::pin!(f); LL ~ let x = pinned.as_ref().get_ref(); | ``` Fix rust-lang/rust#144602.
Diffstat (limited to 'tests/ui/consts')
| -rw-r--r-- | tests/ui/consts/issue-19244-1.stderr | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/ui/consts/issue-19244-1.stderr b/tests/ui/consts/issue-19244-1.stderr index 9c1336402e6..98a33817b4c 100644 --- a/tests/ui/consts/issue-19244-1.stderr +++ b/tests/ui/consts/issue-19244-1.stderr @@ -3,6 +3,8 @@ error[E0609]: no field `1` on type `(usize,)` | LL | let a: [isize; TUP.1]; | ^ unknown field + | + = note: available field is: `0` error: aborting due to 1 previous error |
