Skip to content

Modernize to edition 2024, latest dependencies, workspace-inherited deps - #116

Merged
rudib merged 2 commits into
masterfrom
modernize-edition-2024
Sep 30, 2026
Merged

rudib merged 2 commits into
masterfrom
modernize-edition-2024

Conversation

@rudib

@rudib rudib commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Summary

  • All crates on edition 2024, rust-version = "1.85", resolver = "3".
  • Every dependency on its latest major and minor version: syn 3.0.6 (new major), bitvec 1.1.1, serde 1.0.229, quote 1.0.47, proc-macro2 1.0.107, error-chain 0.12.4.
  • Dependencies and shared metadata (version, authors, edition, rust-version, license, repository) now live in [workspace.dependencies] / [workspace.package]; members use workspace = true.
  • packed_struct and packed_struct_codegen bumped to 0.12.0 because of the MSRV raise.

Fixes the upgrade turned up

  • Derive broken on edition 2024 (affects users). #[derive(PackedStruct)] generated { &<temp> }.pack()?. Edition 2024 drops tail-expression temporaries at the end of the block, so user crates on 2024 failed with E0716. It now emits (&<temp>).pack()?, which is correct in every edition (packed_struct_codegen/src/pack_codegen.rs).
  • alloc feature never built on stable. Removed the nightly-only #![cfg_attr(feature="alloc", feature(alloc))] and added the missing Formatter import to the no_std prelude. Dropped "Requires nightly Rust" from the docs.
  • serde: replaced serde_derive with serde's derive feature (use_serde = ["dep:serde", "serde/derive"]). std used serde/std, which silently turned serde on; it's now serde?/std. The implicit serde / serde_derive features are gone; use_serde is unchanged.
  • bitvec 1.1 deprecations: shift_left/shift_right → shift_start/shift_end.
  • Clippy: the CI clippy step already failed on current stable (15 errors in packed_struct_codegen, then more in packed_struct and the tests). Fixed mechanically: iN::MIN instead of min_value(), two dead fields removed, empty glob re-exports removed, #![allow(unused_imports)] on the internal prelude, and a check-cfg entry for a cfg that error_chain! expands to. The workspace now builds with zero warnings.
  • Removed redundant extern crate / #[macro_use] lines; core::intrinsics::write_bytes → core::ptr::write_bytes.

Reviewer notes

  • packed_struct_nostd_tests stays excluded from the workspace. The codegen emits ::std or ::core paths depending on its own std feature. A workspace-wide build unifies that feature, enabled by packed_struct_tests, and breaks the no_std crate. There's a comment explaining this in the root Cargo.toml.
  • A no_std + alloc user crate still has to declare #[macro_use] extern crate alloc;, because the generated code relies on it. That's unchanged by this PR.
  • CI: actions/checkout@v5, explicit dtolnay/rust-toolchain, feature-combination checks (--no-default-features, +alloc, --all-features), and a new MSRV 1.85 job.
  • Cross matrix: replaced mips64-unknown-linux-gnuabi64 with s390x-unknown-linux-gnu. mips64 has been tier 3 since Rust 1.72 and has no prebuilt std, so cross build failed with "can't find crate for core". s390x keeps a big-endian target in the matrix on tier 2.

Testing

  • cargo test --workspace: 117 passed, 0 failed (same as before), including doctests.
  • cd packed_struct_nostd_tests && cargo test: passes.
  • cargo clippy -p packed_struct_tests --all-targets -- -D warnings: clean.
  • cargo check -p packed_struct with --no-default-features, --no-default-features --features alloc, --no-default-features --features use_serde, --features use_serde,byte_types_256 and --all-features: all pass without warnings.
  • cargo +1.89 check --workspace --all-targets: passes. 1.85 was not installed locally, so the new CI job covers it.
  • cargo package -p packed_struct_codegen: the packaged manifest resolves the inherited fields correctly.

🤖 Generated with Claude Code

rudib and others added 2 commits September 30, 2026 23:20
Move all crates to edition 2024 (MSRV 1.85, resolver 3), bump every
dependency to its latest major/minor release (syn 3.0.6, bitvec 1.1.1,
serde 1.0.229, quote 1.0.47, proc-macro2 1.0.107) and centralize
dependencies and shared package metadata in [workspace.dependencies] /
[workspace.package]. Bump packed_struct and packed_struct_codegen to 0.12.0.

Fixes surfaced by the upgrade:
- PackedStruct derive generated `{ &<temp> }.pack()`, which fails to
  borrow-check in edition 2024 crates due to tail-expression temporary
  scope changes; use `(&<temp>).pack()` instead.
- Remove the nightly-only `#![feature(alloc)]` that made the `alloc`
  feature unbuildable on stable, and add the missing Formatter import
  to the no_std prelude.
- Replace serde_derive with serde's `derive` feature; `std` no longer
  implicitly enables serde (`serde?/std`).
- Use bitvec 1.1's shift_start/shift_end instead of deprecated names.
- Fix clippy lints that already failed CI on current stable; the
  workspace now builds with zero warnings.

packed_struct_nostd_tests stays excluded from the workspace: a
workspace-wide build would unify packed_struct_codegen's `std` feature
and emit std paths into the no_std crate.

CI: checkout@v5, explicit toolchains, feature-combination checks and
an MSRV (1.85) job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mips64-unknown-linux-gnuabi64 was demoted to tier 3 in Rust 1.72 and no
longer ships a prebuilt std, so `cross build` fails with "can't find
crate for `core`". s390x-unknown-linux-gnu keeps big-endian coverage on
a tier 2 target.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rudib
rudib merged commit 1c0eb37 into master Sep 30, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant