diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2025-01-18 20:07:05 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2025-01-18 20:33:15 +0000 |
| commit | deef3ebaec2ff0ff818161f3b9b86a42bed5fe36 (patch) | |
| tree | 29becbbad6d9a19783b3a25dfbcc54e3b5318c80 /tests/ui/error-codes | |
| parent | bbcf26fc33afb4695014aff22fa77dcb7d9eb715 (diff) | |
| download | rust-deef3ebaec2ff0ff818161f3b9b86a42bed5fe36.tar.gz rust-deef3ebaec2ff0ff818161f3b9b86a42bed5fe36.zip | |
Emit a single privacy error for multiple fields on the same struct expression
Collect all unreachable fields in a single struct literal struct and emit a single error, instead of one error per private field.
```
error[E0451]: fields `beta` and `gamma` of struct `Alpha` are private
--> $DIR/visibility.rs:18:13
|
LL | let _x = Alpha {
| ----- in this type
LL | beta: 0,
| ^^^^^^^ private field
LL | ..
| ^^ field `gamma` is private
```
Diffstat (limited to 'tests/ui/error-codes')
| -rw-r--r-- | tests/ui/error-codes/E0451.stderr | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/ui/error-codes/E0451.stderr b/tests/ui/error-codes/E0451.stderr index 419cf117efe..2cd30095c80 100644 --- a/tests/ui/error-codes/E0451.stderr +++ b/tests/ui/error-codes/E0451.stderr @@ -8,7 +8,7 @@ error[E0451]: field `b` of struct `Foo` is private --> $DIR/E0451.rs:18:29 | LL | let f = bar::Foo{ a: 0, b: 0 }; - | ^^^^ private field + | ^ private field error: aborting due to 2 previous errors |
