Skip to content

Commit

Permalink
Silence private_bounds lint in KnownLayout derive
Browse files Browse the repository at this point in the history
For reasons not-yet-known, the `private_bounds` lint flags the
output of `derive(KnownLayout)` on `repr(C)` structs generated
by macros. This is likely a rustc bug, but to preserve a good
experience for our users, we nonetheless, `allow(private_bounds)`.

Fixes #2177
  • Loading branch information
jswrenn committed Dec 23, 2024
1 parent 2c8ef74 commit 6c3825e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions zerocopy-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@ fn derive_known_layout_inner(ast: &DeriveInput, _top_level: Trait) -> Result<Tok
// `#ty`, not `__ZerocopyKnownLayoutMaybeUninit` (see #2116).
#repr
#[doc(hidden)]
// Required on some rustc versions due to a lint that is only
// triggered on macro-generated code. See #2177 for details.
#[allow(private_bounds)]
#vis struct __ZerocopyKnownLayoutMaybeUninit<#params> (
#(::zerocopy::util::macro_util::core_reexport::mem::MaybeUninit<
<#ident #ty_generics as
Expand Down

0 comments on commit 6c3825e

Please sign in to comment.