Skip to content

chore: Bump mlxcel-core to Rust edition 2024 to match the root crate #272

Description

@inureyes

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

  • All workspace crates are on edition 2024.
  • ensure_persistent_ptx_cache (and any other set_var/remove_var call sites) wrap the call in unsafe { ... } with a safety comment.
  • cargo build succeeds 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-core on edition 2021 to stay focused. This issue is the follow-up; do it after #270 merges.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions