error[E0742]: visibilities can only be restricted to ancestor modules --> $DIR/issue-50493.rs:9:12 | LL | pub(in restricted) field: usize, | ^^^^^^^^^^ error[E0616]: field `field` of struct `Restricted` is private --> $DIR/issue-50493.rs:6:10 | LL | #[derive(Derive)] | ^^^^^^ private field | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0616]: field `field` of struct `Restricted` is private --> $DIR/issue-50493.rs:6:10 | LL | #[derive(Derive)] | ^^^^^^ private field | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors Some errors have detailed explanations: E0616, E0742. For more information about an error, try `rustc --explain E0616`.