rust/tests/ui/offset-of/offset-of-tuple-field.stderr
Esteban Küber 26c12c7462 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();
   |               ++
```
2025-08-07 21:39:00 +00:00

130 lines
3.5 KiB
Plaintext

error: suffixes on a tuple index are invalid
--> $DIR/offset-of-tuple-field.rs:15:35
|
LL | builtin # offset_of((u8, u8), 1_u8);
| ^^^^ invalid suffix `u8`
error: suffixes on a tuple index are invalid
--> $DIR/offset-of-tuple-field.rs:9:26
|
LL | offset_of!((u8, u8), 1_u8);
| ^^^^ invalid suffix `u8`
error[E0609]: no field `_0` on type `(u8, u8)`
--> $DIR/offset-of-tuple-field.rs:6:26
|
LL | offset_of!((u8, u8), _0);
| ^^
|
help: a field with a similar name exists
|
LL - offset_of!((u8, u8), _0);
LL + offset_of!((u8, u8), 0);
|
error[E0609]: no field `01` on type `(u8, u8)`
--> $DIR/offset-of-tuple-field.rs:7:26
|
LL | offset_of!((u8, u8), 01);
| ^^
|
help: a field with a similar name exists
|
LL - offset_of!((u8, u8), 01);
LL + offset_of!((u8, u8), 0);
|
error[E0609]: no field `1e2` on type `(u8, u8)`
--> $DIR/offset-of-tuple-field.rs:8:26
|
LL | offset_of!((u8, u8), 1e2);
| ^^^
|
= note: available fields are: `0`, `1`
error[E0609]: no field `1_` on type `(u8, u8)`
--> $DIR/offset-of-tuple-field.rs:9:26
|
LL | offset_of!((u8, u8), 1_u8);
| ^^^^
|
help: a field with a similar name exists
|
LL - offset_of!((u8, u8), 1_u8);
LL + offset_of!((u8, u8), 1);
|
error[E0609]: no field `1e2` on type `(u8, u8)`
--> $DIR/offset-of-tuple-field.rs:12:35
|
LL | builtin # offset_of((u8, u8), 1e2);
| ^^^
|
= note: available fields are: `0`, `1`
error[E0609]: no field `_0` on type `(u8, u8)`
--> $DIR/offset-of-tuple-field.rs:13:35
|
LL | builtin # offset_of((u8, u8), _0);
| ^^
|
help: a field with a similar name exists
|
LL - builtin # offset_of((u8, u8), _0);
LL + builtin # offset_of((u8, u8), 0);
|
error[E0609]: no field `01` on type `(u8, u8)`
--> $DIR/offset-of-tuple-field.rs:14:35
|
LL | builtin # offset_of((u8, u8), 01);
| ^^
|
help: a field with a similar name exists
|
LL - builtin # offset_of((u8, u8), 01);
LL + builtin # offset_of((u8, u8), 0);
|
error[E0609]: no field `1_` on type `(u8, u8)`
--> $DIR/offset-of-tuple-field.rs:15:35
|
LL | builtin # offset_of((u8, u8), 1_u8);
| ^^^^
|
help: a field with a similar name exists
|
LL - builtin # offset_of((u8, u8), 1_u8);
LL + builtin # offset_of((u8, u8), 1);
|
error[E0609]: no field `2` on type `(u8, u16)`
--> $DIR/offset-of-tuple-field.rs:18:47
|
LL | offset_of!(((u8, u16), (u32, u16, u8)), 0.2);
| ^
|
help: a field with a similar name exists
|
LL - offset_of!(((u8, u16), (u32, u16, u8)), 0.2);
LL + offset_of!(((u8, u16), (u32, u16, u8)), 0.0);
|
error[E0609]: no field `1e2` on type `(u8, u16)`
--> $DIR/offset-of-tuple-field.rs:19:47
|
LL | offset_of!(((u8, u16), (u32, u16, u8)), 0.1e2);
| ^^^
|
= note: available fields are: `0`, `1`
error[E0609]: no field `0` on type `u8`
--> $DIR/offset-of-tuple-field.rs:21:49
|
LL | offset_of!(((u8, u16), (u32, u16, u8)), 1.2.0);
| ^
error: aborting due to 13 previous errors
For more information about this error, try `rustc --explain E0609`.