about summary refs log tree commit diff
path: root/tests/ui/tuple/tuple-index-out-of-bounds.stderr
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2025-07-29 18:39:16 +0000
committerEsteban Küber <esteban@kuber.com.ar>2025-08-07 21:39:00 +0000
commit26c12c746296e01c2dc13d8078b0a2f1569fcb1c (patch)
treed985e0de99807696015bc4724270eafeefa0d8b7 /tests/ui/tuple/tuple-index-out-of-bounds.stderr
parent2fd855fbfc8239285aa2d596f76a8cc75e17ce02 (diff)
downloadrust-26c12c746296e01c2dc13d8078b0a2f1569fcb1c.tar.gz
rust-26c12c746296e01c2dc13d8078b0a2f1569fcb1c.zip
Account for bare tuples 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.

```
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();
   |               ++
```
Diffstat (limited to 'tests/ui/tuple/tuple-index-out-of-bounds.stderr')
-rw-r--r--tests/ui/tuple/tuple-index-out-of-bounds.stderr6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/ui/tuple/tuple-index-out-of-bounds.stderr b/tests/ui/tuple/tuple-index-out-of-bounds.stderr
index 8b3c835c3e3..72827690909 100644
--- a/tests/ui/tuple/tuple-index-out-of-bounds.stderr
+++ b/tests/ui/tuple/tuple-index-out-of-bounds.stderr
@@ -15,6 +15,12 @@ error[E0609]: no field `2` on type `({integer}, {integer})`
    |
 LL |     tuple.2;
    |           ^ unknown field
+   |
+help: a field with a similar name exists
+   |
+LL -     tuple.2;
+LL +     tuple.0;
+   |
 
 error: aborting due to 2 previous errors