about summary refs log tree commit diff
path: root/compiler/rustc_privacy/src/errors.rs
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2025-01-18 01:56:22 +0000
committerEsteban Küber <esteban@kuber.com.ar>2025-01-18 01:56:22 +0000
commitbbcf26fc33afb4695014aff22fa77dcb7d9eb715 (patch)
tree89fa7b0b3844f81b310ee203fa1f3ff445756e62 /compiler/rustc_privacy/src/errors.rs
parent3e99055c4099f0ccb3e5ce5768c32af57d48c79b (diff)
downloadrust-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 'compiler/rustc_privacy/src/errors.rs')
-rw-r--r--compiler/rustc_privacy/src/errors.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_privacy/src/errors.rs b/compiler/rustc_privacy/src/errors.rs
index f5e641eb642..23181f63a28 100644
--- a/compiler/rustc_privacy/src/errors.rs
+++ b/compiler/rustc_privacy/src/errors.rs
@@ -8,6 +8,8 @@ use rustc_span::{Span, Symbol};
 pub(crate) struct FieldIsPrivate {
     #[primary_span]
     pub span: Span,
+    #[label]
+    pub struct_span: Option<Span>,
     pub field_name: Symbol,
     pub variant_descr: &'static str,
     pub def_path_str: String,