-
Notifications
You must be signed in to change notification settings - Fork 13.7k
check non_exhaustive attr and private fields for transparent types #99020
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
check non_exhaustive attr and private fields for transparent types #99020
Conversation
r? @oli-obk (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
b182668
to
6919a57
Compare
I think we also need to address enums: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=7cfa15a0f159c2aff5f070ac52f4d485 Also, I'm not actually sure what the expected behaviour of exporting #[non_exhaustive]
pub struct Foo {}
#[repr(transparent)]
pub struct Baz(pub Foo); can |
No, and this checks that as it recurses into the fields and error if any transitive field is non_exhaustive or has private fields. |
cool, please add tests for that! |
@rustbot author |
6919a57
to
5fb6784
Compare
There are several tests that already test this (See |
@bors r+ |
…non_exhaustive, r=oli-obk check non_exhaustive attr and private fields for transparent types Fixes rust-lang#78586.
…non_exhaustive, r=oli-obk check non_exhaustive attr and private fields for transparent types Fixes rust-lang#78586.
…non_exhaustive, r=oli-obk check non_exhaustive attr and private fields for transparent types Fixes rust-lang#78586.
c96a22c
to
d812850
Compare
@bors r+ |
…non_exhaustive, r=oli-obk check non_exhaustive attr and private fields for transparent types Fixes rust-lang#78586.
…non_exhaustive, r=oli-obk check non_exhaustive attr and private fields for transparent types Fixes rust-lang#78586.
d812850
to
1d26006
Compare
@bors r=oli-obk minor doc change, no need to review again |
…laumeGomez Rollup of 10 pull requests Successful merges: - rust-lang#98789 (rustdoc-json-types: Clean up derives.) - rust-lang#98848 (Build the Clippy book as part of x.py doc) - rust-lang#99020 (check non_exhaustive attr and private fields for transparent types) - rust-lang#99132 (Add some autolabels for A-bootstrap and T-infra) - rust-lang#99148 (Clarify that [iu]size bounds were only defined for the target arch) - rust-lang#99152 (Use CSS variables to handle theming (part 2)) - rust-lang#99168 (Add regression test for rust-lang#74713) - rust-lang#99176 (:arrow_up: rust-analyzer) - rust-lang#99183 (Mention rust-analyzer maintainers when `proc_macro` bridge is changed) - rust-lang#99185 (llvm-wrapper: adapt for LLVM API change) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #78586.