Skip to content

chore: Bump Rust edition to 2024#1265

Draft
szokeasaurusrex wants to merge 4 commits into
masterfrom
cursor/bump-rust-edition-2024-ac4d
Draft

chore: Bump Rust edition to 2024#1265
szokeasaurusrex wants to merge 4 commits into
masterfrom
cursor/bump-rust-edition-2024-ac4d

Conversation

@szokeasaurusrex

@szokeasaurusrex szokeasaurusrex commented Jul 24, 2026

Copy link
Copy Markdown
Member

Description

Bump the workspace Rust edition from 2021 to 2024 (and Cargo resolver from 2 to 3), as suggested in #970 / #971.

MSRV is already 1.88, so no toolchain bump is required for edition 2024.

Follow-up fixes from the edition change:

  • Apply rustfmt’s edition-2024 import sorting across the workspace
  • Collapse nested if / if let into if … && let chains so stable clippy’s collapsible_if lint stays clean
  • Stop mutating the process environment via std::env::set_var (now unsafe and only sound without concurrent environment access). Examples/docs no longer set RUST_BACKTRACE; anyhow backtrace tests require it to already be set (provided in CI)

Issues

Open in Web Open in Cursor 

Edition 2024 pairs with Cargo resolver 3, which was suggested as a way
to keep dependency resolution aligned with the workspace MSRV. MSRV is
already 1.88, so only the edition/resolver change is needed.

Also wrap `std::env::set_var` call sites in `unsafe` (now required) and
apply rustfmt's edition-2024 import sorting.

Closes #971

Co-authored-by: Daniel Szoke <szokeasaurusrex@users.noreply.github.com>
@linear-code

linear-code Bot commented Jul 24, 2026

Copy link
Copy Markdown

RUST-137

cursoragent and others added 3 commits July 24, 2026 15:36
Closes [#971](#971)
Closes [RUST-137](https://linear.app/getsentry/issue/RUST-137/bump-rust-edition-to-2024)

Co-authored-by: Daniel Szoke <szokeasaurusrex@users.noreply.github.com>
Stable clippy (1.97) treats nested `if`/`if let` as `collapsible_if`
and suggests `if … && let` chains, which edition 2024 enables.

Related to [#971](#971)
Related to [RUST-137](https://linear.app/getsentry/issue/RUST-137/bump-rust-edition-to-2024)

Co-authored-by: Daniel Szoke <szokeasaurusrex@users.noreply.github.com>
`set_var` is unsafe because concurrent environment access is UB on
many platforms. Wrapping the old call sites in `unsafe` did not establish
that precondition (and the actix example even started a multi-threaded
runtime afterward).

Remove process-environment mutation from examples/docs/tests, require
`RUST_BACKTRACE=1` to already be set for anyhow backtrace tests (CI now
provides it), and drop the changelog entry for this work.

Related to [#971](#971)
Related to [RUST-137](https://linear.app/getsentry/issue/RUST-137/bump-rust-edition-to-2024)

Co-authored-by: Daniel Szoke <szokeasaurusrex@users.noreply.github.com>
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.

Bump Rust edition to 2024

2 participants