diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2025-01-18 01:56:22 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2025-01-18 01:56:22 +0000 |
| commit | bbcf26fc33afb4695014aff22fa77dcb7d9eb715 (patch) | |
| tree | 89fa7b0b3844f81b310ee203fa1f3ff445756e62 /tests/ui | |
| parent | 3e99055c4099f0ccb3e5ce5768c32af57d48c79b (diff) | |
| download | rust-bbcf26fc33afb4695014aff22fa77dcb7d9eb715.tar.gz rust-bbcf26fc33afb4695014aff22fa77dcb7d9eb715.zip | |
Add context on private fields that are not on the same line as the struct name
```
error[E0451]: field `x` of struct `S` is private
--> $DIR/visibility.rs:24:9
|
LL | let a = baz::S {
| ------ in this type
LL | ..
| ^^ field `x` is private
```
Diffstat (limited to 'tests/ui')
| -rw-r--r-- | tests/ui/deprecation/deprecation-lint.stderr | 3 | ||||
| -rw-r--r-- | tests/ui/structs/default-field-values/visibility.stderr | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/tests/ui/deprecation/deprecation-lint.stderr b/tests/ui/deprecation/deprecation-lint.stderr index 2098073409d..075bb42fa9a 100644 --- a/tests/ui/deprecation/deprecation-lint.stderr +++ b/tests/ui/deprecation/deprecation-lint.stderr @@ -739,6 +739,9 @@ LL | _) error[E0451]: field `i` of struct `this_crate::nested::DeprecatedStruct` is private --> $DIR/deprecation-lint.rs:280:13 | +LL | let _ = nested::DeprecatedStruct { + | ------------------------ in this type +LL | LL | i: 0 | ^^^^ private field diff --git a/tests/ui/structs/default-field-values/visibility.stderr b/tests/ui/structs/default-field-values/visibility.stderr index 63721d79be5..666782933d3 100644 --- a/tests/ui/structs/default-field-values/visibility.stderr +++ b/tests/ui/structs/default-field-values/visibility.stderr @@ -1,12 +1,16 @@ error[E0451]: field `x` of struct `S` is private --> $DIR/visibility.rs:24:9 | +LL | let a = baz::S { + | ------ in this type LL | .. | ^^ field `x` is private error[E0451]: field `x` of struct `S` is private --> $DIR/visibility.rs:27:9 | +LL | let b = baz::S { + | ------ in this type LL | x: 0, | ^^^^ private field |
