Skip to content

chore: Bump Rust edition to 2024#1265

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

chore: Bump Rust edition to 2024#1265
szokeasaurusrex wants to merge 10 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 from tests (no straightforward sound alternative to set_var here); keep only env-independent assertions
  • Actix docs/examples note to run with RUST_BACKTRACE=1 for full backtraces

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 9 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>
Document that actix examples expect `RUST_BACKTRACE=1` in the process
environment for full backtraces, and why they avoid `std::env::set_var`.

Use `temp-env` in unit tests so `SENTRY_ENVIRONMENT` / `RUST_BACKTRACE`
are set for the cases that need them, with serialized access across
concurrent tests.

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>
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>
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 `SENTRY_ENVIRONMENT` / `RUST_BACKTRACE` via `Command::env` in a
re-exec'd test child instead of pulling in `temp-env`.

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>
Controlling process environment from `cargo test` is not straightforward
after `set_var` became unsafe: in-process mutation is unsound with
concurrent env access, and child-process re-exec harnesses are awkward.
Keep only assertions that do not need a crafted environment.

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>
CI already sets `RUST_BACKTRACE=1`, so this coverage does not need
in-process environment mutation.

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