|
| 1 | +# ADR-T-005: Migrate to Rust Edition 2024 |
| 2 | + |
| 3 | +**Status:** Decided |
| 4 | +**Date:** 2026-03-23 |
| 5 | +**Supersedes:** [ADR-T-003](./003-edition-2024-preparation.md) |
| 6 | +(preparation / dependency pinning) |
| 7 | + |
| 8 | +## Context |
| 9 | + |
| 10 | +ADR-T-003 raised the MSRV to 1.83 and pinned several transitive |
| 11 | +dependencies to avoid edition-2024-only releases while the workspace |
| 12 | +remained on edition 2021. That was explicitly described as a |
| 13 | +temporary measure — the intention was always to complete the |
| 14 | +migration in a follow-up. |
| 15 | + |
| 16 | +Rust edition 2024 was stabilised in rustc 1.85. `cargo fix --edition` |
| 17 | +reported only one automatic fix (an `if_let_rescope` rewrite in |
| 18 | +`handlers.rs`), confirming that the codebase was already |
| 19 | +well-prepared by the 2024-compatibility lint group enabled in |
| 20 | +ADR-T-003. |
| 21 | + |
| 22 | +## Decision |
| 23 | + |
| 24 | +**Migrate the entire workspace to `edition = "2024"` and raise |
| 25 | +the MSRV to 1.85.** |
| 26 | + |
| 27 | +### Changes |
| 28 | + |
| 29 | +| Setting / File | From | To | Reason | |
| 30 | +| ---------------------------------------------- | --------------- | --------------- | ---------------------------------------------------------------------- | |
| 31 | +| `workspace.package.version` | `3.1.0-develop` | `4.0.0-develop` | Major bump for edition change | |
| 32 | +| `workspace.package.edition` | `"2021"` | `"2024"` | Edition migration | |
| 33 | +| `workspace.package.rust-version` | `1.83` | `1.85` | Minimum compiler for edition 2024 | |
| 34 | +| `workspace.lints.rust.rust-2024-compatibility` | `warn` | `deny` | Now the active edition; violations must not land | |
| 35 | +| `handlers.rs` — `#[allow(if_let_rescope)]` | present | removed | Lint no longer needed; behaviour is native to edition 2024 | |
| 36 | +| `rand` direct dependency | `"0.9"` | `"0.10"` | ADR-T-003 pin no longer needed; edition 2024 satisfies `rand 0.10` | |
| 37 | +| `use rand::Rng` (5 files) | `Rng` | `RngExt` | Trait renamed in `rand 0.10` | |
| 38 | +| `jsonwebtoken` direct dependency | `"9.3"` | `"10"` | ADR-T-003 pin no longer needed; v10 works with pinned `simple_asn1` | |
| 39 | + |
| 40 | +### Dependency-pin status |
| 41 | + |
| 42 | +Most of the transitive-dependency pins from ADR-T-003 were lifted by |
| 43 | +a routine `cargo update` after the edition migration. The MSRV-aware |
| 44 | +resolver (active by default in edition 2024) automatically selects |
| 45 | +the latest MSRV-compatible version for most crates. |
| 46 | + |
| 47 | +#### Pins lifted (now at latest compatible versions) |
| 48 | + |
| 49 | +`clap`, `clap_builder`, `clap_derive`, `clap_lex`, `globset`, |
| 50 | +`ignore`, `image`, `png`, `quickcheck`, `env_logger`, `uuid`, |
| 51 | +`base64ct`, `psm`, `tera`, `deranged`, `home`. |
| 52 | + |
| 53 | +#### Pins still required |
| 54 | + |
| 55 | +The `time` family still requires manual pinning because |
| 56 | +`simple_asn1 ≥ 0.6.4` demands `time ^0.3.47`, which requires |
| 57 | +Rust 1.88. The MSRV-aware resolver cannot satisfy both the |
| 58 | +`simple_asn1` version constraint and the MSRV floor, so it falls |
| 59 | +back and pulls in the incompatible version. |
| 60 | + |
| 61 | +| Crate | Pinned to | Latest | Reason | |
| 62 | +| -------------- | --------- | ------- | --------------------------------------- | |
| 63 | +| `simple_asn1` | 0.6.3 | 0.6.4 | 0.6.4 requires `time ^0.3.47` | |
| 64 | +| `time` | 0.3.45 | 0.3.47 | 0.3.47 requires Rust 1.88 | |
| 65 | +| `time-core` | 0.1.7 | 0.1.8 | 0.1.8 requires Rust 1.88 | |
| 66 | +| `time-macros` | 0.2.25 | 0.2.27 | 0.2.27 requires Rust 1.88 | |
| 67 | +| `num-conv` | 0.1.0 | 0.2.0 | pulled by `time` | |
| 68 | +| `psm` | 0.1.24 | 0.1.30 | 0.1.30 adds `ar_archive_writer` (unstable `let` exprs) | |
| 69 | + |
| 70 | +After `cargo update`, re-pin with: |
| 71 | + |
| 72 | +```sh |
| 73 | +cargo update simple_asn1@0.6.4 --precise 0.6.3 |
| 74 | +cargo update time@0.3.47 --precise 0.3.45 |
| 75 | +cargo update psm@0.1.30 --precise 0.1.24 |
| 76 | +``` |
| 77 | + |
| 78 | +These pins can be dropped once `time` publishes a Rust-1.85-compatible |
| 79 | +release above 0.3.47, or when the workspace MSRV is raised to 1.88+. |
| 80 | + |
| 81 | +## Consequences |
| 82 | + |
| 83 | +- The workspace compiles and passes all tests (`--all-features`, |
| 84 | + `--no-default-features`, `--release`, `--doc`) on rustc 1.85+. |
| 85 | +- Contributors must use rustc ≥ 1.85. |
| 86 | +- Edition-2024 language features (e.g. `gen` keyword reservation, |
| 87 | + `unsafe_op_in_unsafe_fn` default, tail-expression temporaries) |
| 88 | + are now available throughout the codebase. |
| 89 | +- The `rust-2024-compatibility` lint group is promoted to `deny`, |
| 90 | + preventing future regressions. |
0 commit comments