Summary
The root mlxcel crate is on edition 2024, but src/lib/mlxcel-core/Cargo.toml is still on edition 2021. Align mlxcel-core (and any other workspace members still on 2021) to edition 2024 so the workspace is consistent and picks up the 2024 defaults/lints.
Why now
PR #270 added mlxcel_core::ensure_persistent_ptx_cache(), which calls std::env::set_var. In edition 2021 set_var is safe, so it compiles without unsafe; in edition 2024 set_var/remove_var are unsafe. When mlxcel-core moves to 2024 that call must be wrapped in unsafe { ... } with a short safety comment (it runs once at startup before any worker threads spawn). This is the one known required touch-up, but the migration should be done deliberately rather than ad hoc.
Scope and risks
Edition 2024 is more than set_var. A careful migration should account for:
std::env::set_var/remove_var become unsafe (wrap the call in ensure_persistent_ptx_cache, plus any other call sites).
gen becomes a reserved keyword (rename any identifier named gen).
- RPIT (return-position
impl Trait) lifetime capture rule change (may need use<...> bounds).
if let temporary scope / drop-timing change.
unsafe extern blocks.
- Other 2024 default changes surfaced by the migration.
mlxcel-core is large and carries the cxx FFI bridge, so the surface is non-trivial and some changes only appear in cfg-gated code (CUDA, Metal).
Approach
- Run
cargo fix --edition on mlxcel-core (and any other 2021 members), then bump edition = "2024" in their Cargo.toml.
- Review the auto-applied changes; hand-fix anything
cargo fix cannot.
- Verify with a full build on every backend that matters, including the CUDA path (edition changes can hide in
#[cfg(feature = "cuda")] code that a macOS build never compiles), plus cargo clippy --all-targets -D warnings and cargo fmt --check.
Acceptance criteria
Context
Spun out of #270 (CUDA NVRTC-JIT UX work), which intentionally kept mlxcel-core on edition 2021 to stay focused. This issue is the follow-up; do it after #270 merges.
Summary
The root
mlxcelcrate is on edition 2024, butsrc/lib/mlxcel-core/Cargo.tomlis still on edition 2021. Alignmlxcel-core(and any other workspace members still on 2021) to edition 2024 so the workspace is consistent and picks up the 2024 defaults/lints.Why now
PR #270 added
mlxcel_core::ensure_persistent_ptx_cache(), which callsstd::env::set_var. In edition 2021set_varis safe, so it compiles withoutunsafe; in edition 2024set_var/remove_varareunsafe. Whenmlxcel-coremoves to 2024 that call must be wrapped inunsafe { ... }with a short safety comment (it runs once at startup before any worker threads spawn). This is the one known required touch-up, but the migration should be done deliberately rather than ad hoc.Scope and risks
Edition 2024 is more than
set_var. A careful migration should account for:std::env::set_var/remove_varbecomeunsafe(wrap the call inensure_persistent_ptx_cache, plus any other call sites).genbecomes a reserved keyword (rename any identifier namedgen).impl Trait) lifetime capture rule change (may needuse<...>bounds).if lettemporary scope / drop-timing change.unsafe externblocks.mlxcel-coreis large and carries thecxxFFI bridge, so the surface is non-trivial and some changes only appear incfg-gated code (CUDA, Metal).Approach
cargo fix --editiononmlxcel-core(and any other 2021 members), then bumpedition = "2024"in theirCargo.toml.cargo fixcannot.#[cfg(feature = "cuda")]code that a macOS build never compiles), pluscargo clippy --all-targets -D warningsandcargo fmt --check.Acceptance criteria
ensure_persistent_ptx_cache(and any otherset_var/remove_varcall sites) wrap the call inunsafe { ... }with a safety comment.cargo buildsucceeds on macOS (metal,accelerate) and on Linux CUDA; clippy and fmt are clean.Context
Spun out of #270 (CUDA NVRTC-JIT UX work), which intentionally kept
mlxcel-coreon edition 2021 to stay focused. This issue is the follow-up; do it after #270 merges.