Rust 1.100.0 shipped on 2026-11-12 and retired an error code that had been failing FFI builds since 2015. error[E0588]: packed type cannot transitively contain a #[repr(align)] type is now the deny-by-default lint aligned_fields_in_packed, landed in rust-lang/rust#162160 with tracking issue #162689. The release notes file it under Language in a single line. That line leaves out the consequence: Cargo caps lints in upstream code, so a check that nothing in your dependency graph could bypass is now one that every crate in your graph bypasses by default.
TL;DR: The diagnostic text is unchanged but the E-number is gone, so E0588 greps in CI pass on code that still trips the check. The rewritten condition in compiler/rustc_hir_analysis/src/check/check.rs is def.repr().c() && (def.is_struct() || def.is_union()), which drops any chain missing repr(C). To see the lint in dependencies at all, build with RUSTFLAGS="--force-warn aligned_fields_in_packed" cargo build --target x86_64-pc-windows-msvc.
Did the error go away, or only the number?
The message survived verbatim. What you get on 1.100.0 is this:
error: packed type cannot transitively contain a #[repr(align)] type
= note: `#[deny(aligned_fields_in_packed)]` on by default
Same first line, no code. The PR edits compiler/rustc_error_codes/src/error_codes/E0588.md to add the standard "this error code is no longer emitted by the compiler" banner and re-marks its example as ignore (no longer emitted). So rustc --explain E0588 still resolves, and tells you the thing it explains cannot happen.
That combination is a quiet failure for tooling. A bindgen wrapper, a build script, or a release gate that matches on the string E0588 or on the code field of cargo build --message-format=json will report success against a crate that the compiler is still rejecting, and a gate that passes for a reason unrelated to the code under test is the same class of problem as Terraform 1.17 -minimal-refresh.
What the PR actually narrowed
You need the 1.100.0 toolchain to observe any of this, which for most teams arrives whenever the runner image rolls its language defaults rather than on a deliberate bump: ubuntu-latest.
The honest framing comes from the author. RalfJung opened #162160 with "The aligned-in-packed check ignores the fact that generics exist, so it can trivially be bypassed," and described the new scope directly: "I currently require the outer packed type, the inner aligned type, and all the types in between to be repr(C)." The PR's test file tests/ui/repr/repr-packed-contains-align.rs encodes both new negatives, SG for an outer type without repr(C) and SH for an inner one.
The issue it closes, rust-lang/rust#80926, is from January 2021 and is worth reading end to end, because it is a user asking the compiler team not to close the bypass: they needed it to talk to a C API. nagisa told the reporter they were "relying on what is explicitly been considered an unspecified behaviour." In 2023 pnkfelix recorded the t-lang decision as "We think the restriction can be safely lifted," adding "We would not object if the restriction were readded in the form of a best-effort lint." Three years on, that is exactly what shipped, and "best-effort" is doing real work in that sentence.
Which packed types stop being checked?
Five configurations now produce an undiagnosed repr(packed) type containing an aligned one. Only one of them is new in 1.100, and the other four are the reason the check was downgraded rather than tightened.
- Generics. Supply the aligned type through a type parameter and the check never ran, before or after. This is the 2021 bug.
- Alignment inherited from a field type. scottmcm's review note cites
[u16; 0]; tmandry adds that "including au32in your type also modifies the alignment and we won't lint in that case." Only an explicitalignattribute is seen. - Any type in the chain without
repr(C). New in 1.100, per the condition quoted above. #[allow(aligned_fields_in_packed)], which a hard error never permitted.--cap-lints allow, the default for every crates.io and git dependency.
Why a dependency goes quiet
Deny-by-default in your own crate is loud. In a dependency it is nothing, because RFC 1193 has Cargo cap lints in upstream code so that dependency warnings stay out of your build output. Before 1.100 the compiler refused to build such a crate regardless of where it sat in the graph. After 1.100 it compiles, silently, with GCC-convention layout, on x86_64-pc-windows-msvc.
There is a second channel that could have caught this, and it is also closed: the lint carries no @future_incompatible marker in its declare_lint! block, so it will never show up in cargo report future-incompatibilities either. The 1.100 release has a pattern of Cargo-side protections that stop at the dependency boundary in ways the headline does not advertise, which is also the shape of cargo min-publish-age.
What MSVC does differently
The lint's entry in the rustc book's deny-by-default listing states the defect without hedging: "The behavior of this combination of hints is inconsistent across C compilers. The layout computed for these types by Rust may thus not match the layout actually used by C. Specifically, Rust always follows the GCC convention, which makes it incompatible with MSVC for these types."
So the failure is a struct whose fields land at different offsets than the C side expects, on a Tier 1 target, with no diagnostic at any stage. tmandry made that the argument for the level in the FCP thread: "For deny-by-default, it's a reasonable choice since this misbehaves on a Tier 1 platform." A silent offset disagreement is harder to chase than a loud toolchain failure on the same platform, of the sort that LNK1117 at least hands you up front.
Deleting repr(C) does not change the layout
The fix that will circulate in issue threads over the next few months is removing repr(C) from one of the types in the chain. It silences the lint. It also leaves the layout byte-for-byte identical, because Rust computes the GCC-convention layout either way. What you have given up is the declaration that the layout is meant to match C, which converts a named, documented MSVC mismatch into an unspecified one that no future lint can reason about. If a -sys crate in your tree loses a repr(C) in a commit titled as a 1.100 compatibility fix, that commit made the problem harder to find.
Declaring the type is legal now; using it still is not
The long-standing ask in rust-lang/rust#100743 was an AtomicU32 inside a repr(packed(4)) struct. On 1.100 that declaration compiles, once repr(C) is off the chain. Then &self.field is rejected as E0793, "reference to packed field is unaligned," and the only way to touch the field remains &raw const plus read_unaligned, which hands you a copy and no atomicity. tmandry put the same point in review: "if you're relying on the alignment in your unsafe code you should really start from a reference, and you can't get that from a field in a #[repr(packed)] struct." The relaxation is about what the type checker accepts at the definition, not about what you can do with the field.
What to run on a 1.100.0 toolchain this week
- Build the probe. One crate with a
#[repr(C, packed)]struct over a#[repr(C, align(16))]type, consumed twice: once as apathdependency, once from a local registry or git source with nothing else changed. The path build denies; the registry build is silent. One changed value inCargo.tomltells you how much of your graph the check still covers. - Add
RUSTFLAGS="--force-warn aligned_fields_in_packed"to whichever job builds MSVC targets. The rustc lint-levels page specifies that--force-warn"takes precedence over attributes and all other CLI flags" and is not overridden by--cap-lints allow. A[lints]table inCargo.tomlwill not do this, because it covers your own package only. - Verify that interaction yourself instead of trusting the paragraph above. rust-lang/rust#142610 records the cap-lints and force-warn behaviour as underspecified and under-tested, which is the one claim here I would not ship to a release gate on documentation alone.
- Replace every
E0588match in CI greps, release tooling, and build scripts withaligned_fields_in_packed. The code is retired; the sentence is not. - Grep recent diffs on any
-syscrate you own for removedrepr(C)attributes near packed structs, and treat each one as an unresolved ABI question rather than a completed fix.
Run it against your own graph before you take my word for any of it: RUSTFLAGS="--force-warn aligned_fields_in_packed" cargo build --target x86_64-pc-windows-msvc.
Comments
Be the first to comment.