rust/tests/ui/destructuring-assignment/struct_destructure_fail.stderr
Esteban Küber f0845adb0c Show diff suggestion format on verbose replacement
```
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
  --> $DIR/attempted-access-non-fatal.rs:7:15
   |
LL |     let _ = 2.l;
   |               ^
   |
help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix
   |
LL -     let _ = 2.l;
LL +     let _ = 2.0f64;
   |
```
2025-02-10 20:21:39 +00:00

57 lines
1.8 KiB
Text

error: expected identifier, found reserved identifier `_`
--> $DIR/struct_destructure_fail.rs:11:17
|
LL | Struct { a, _ } = Struct { a: 1, b: 2 };
| ------ ^ expected identifier, found reserved identifier
| |
| while parsing this struct
error: functional record updates are not allowed in destructuring assignments
--> $DIR/struct_destructure_fail.rs:13:19
|
LL | Struct { a, ..d } = Struct { a: 1, b: 2 };
| ^ help: consider removing the trailing pattern
error[E0026]: struct `Struct` does not have a field named `c`
--> $DIR/struct_destructure_fail.rs:10:20
|
LL | Struct { a, b, c } = Struct { a: 0, b: 1 };
| ^ struct `Struct` does not have this field
error[E0027]: pattern does not mention field `b`
--> $DIR/struct_destructure_fail.rs:11:5
|
LL | Struct { a, _ } = Struct { a: 1, b: 2 };
| ^^^^^^^^^^^^^^^ missing field `b`
|
help: include the missing field in the pattern
|
LL - Struct { a, _ } = Struct { a: 1, b: 2 };
LL + Struct { a, b } = Struct { a: 1, b: 2 };
|
help: if you don't care about this missing field, you can explicitly ignore it
|
LL - Struct { a, _ } = Struct { a: 1, b: 2 };
LL + Struct { a, b: _ } = Struct { a: 1, b: 2 };
|
help: or always ignore missing fields here
|
LL - Struct { a, _ } = Struct { a: 1, b: 2 };
LL + Struct { a, .. } = Struct { a: 1, b: 2 };
|
error[E0797]: base expression required after `..`
--> $DIR/struct_destructure_fail.rs:15:19
|
LL | Struct { a, .. };
| ^
|
help: add a base expression here
|
LL | Struct { a, ../* expr */ };
| ++++++++++
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0026, E0027, E0797.
For more information about an error, try `rustc --explain E0026`.