You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
zerocopyPrimary scope: zerocopy crate family (`zerocopy/` and `zerocopy-derive`)zerocopy-deriveSub-crate refinement of `zerocopy` (`zerocopy/zerocopy-derive/`)
triggers the clippy::empty_enums lint, which is part of the clippy::pedantic group. With the never type now nearing stabilization (rust-lang/rust#155499), it would be nice to have this sorted out reasonably soon.
Some findings from a downstream project (Rust nightly-2026-08-29, zerocopy 0.8.56) that may help pin this down — it is now broader than the #![feature(never_type)] case in the report:
Why it started firing everywhere.clippy::empty_enums is guarded on cx.tcx.features().never_type(). rust-lang/rust#155499 stabilized never_type on 2026-08-24, so from nightly-2026-08-25 onward that guard is true in every crate, with or without the feature attribute. Any downstream crate that denies clippy::nursery (the lint's group on current clippy; pedantic on older versions) now fails on every zerocopy derive site:
error: enum with no variants
--> src/ntfs/boot_sector.rs:15:30
|
15 | #[derive(Debug, Clone, Copy, FromBytes, Immutable, KnownLayout)]
| ^^^^^^^^^
= note: `-D clippy::empty-enums` implied by `-D clippy::nursery`
= note: this error originates in the derive macro `FromBytes`
Where the enums come from.derive_has_field_struct_union (zerocopy-derive/src/derive/try_from_bytes.rs) emits one uninhabited #vis enum ẕ<field> {} per struct/union field as a type-level field token. They are wrapped in the const _: () = { … } block built by const_block in util.rs, whose #[allow(...)] list covers non_camel_case_types, non_local_definitions, clippy::missing_inline_in_public_items, … but not clippy::empty_enums. Because derive output carries call-site spans, clippy's external-macro suppression does not apply and the diagnostic lands on the user's #[derive] line — so users cannot fix it short of an #[allow] around every derive site.
Verified fix. Adding clippy::empty_enums to that generated #[allow(...)] list (next to clippy::missing_inline_in_public_items) takes a 14-site workspace from 14 errors to clean under cargo +nightly-2026-08-29 clippy --workspace --all-targets --all-features -- -D warnings, with the lint still enabled for user code. I put that one-line change up as #3600 in case it is useful; happy to close it if you prefer a different shape (e.g. a clippy-side is_from_proc_macro guard).
zerocopyPrimary scope: zerocopy crate family (`zerocopy/` and `zerocopy-derive`)zerocopy-deriveSub-crate refinement of `zerocopy` (`zerocopy/zerocopy-derive/`)
Activity
githubrobbi commentedon Aug 29, 2026
Some findings from a downstream project (Rust nightly-2026-08-29, zerocopy 0.8.56) that may help pin this down — it is now broader than the
#![feature(never_type)]case in the report:Why it started firing everywhere.
clippy::empty_enumsis guarded oncx.tcx.features().never_type(). rust-lang/rust#155499 stabilizednever_typeon 2026-08-24, so from nightly-2026-08-25 onward that guard istruein every crate, with or without the feature attribute. Any downstream crate that deniesclippy::nursery(the lint's group on current clippy;pedanticon older versions) now fails on every zerocopy derive site:Where the enums come from.
derive_has_field_struct_union(zerocopy-derive/src/derive/try_from_bytes.rs) emits one uninhabited#vis enum ẕ<field> {}per struct/union field as a type-level field token. They are wrapped in theconst _: () = { … }block built byconst_blockinutil.rs, whose#[allow(...)]list coversnon_camel_case_types,non_local_definitions,clippy::missing_inline_in_public_items, … but notclippy::empty_enums. Because derive output carries call-site spans, clippy's external-macro suppression does not apply and the diagnostic lands on the user's#[derive]line — so users cannot fix it short of an#[allow]around every derive site.Verified fix. Adding
clippy::empty_enumsto that generated#[allow(...)]list (next toclippy::missing_inline_in_public_items) takes a 14-site workspace from 14 errors to clean undercargo +nightly-2026-08-29 clippy --workspace --all-targets --all-features -- -D warnings, with the lint still enabled for user code. I put that one-line change up as #3600 in case it is useful; happy to close it if you prefer a different shape (e.g. a clippy-sideis_from_proc_macroguard).docs(toolchain): record why the nightly pin holds at 2026-08-21
chore(deps): update seven workspace dependencies and audit every delta
chore(deps): update five workspace dependencies and audit every delta
chore(toolchain): bump the pin to nightly-2026-10-14 and fix what it …
chore(toolchain): bump the pin to nightly-2026-10-14 and fix what it …
impervius commentedon Nov 17, 2026
Now that this feature is stable and rust 1.100 is out, clippy (with nursery) does not pass on codebases that uses zerocopy.
docs(issues): [#2360] record the upstream research and the Temporary …
Merge #2922: docs(issues): [#2360] record the Temporary decision and …