chore!: migrate workspace to Rust edition 2024#839
Conversation
…text Replace the first-party `torrust-index-located-error` crate with direct `tracing::error!` calls at error-construction sites. The `LocatedError<'static, dyn Error + Send + Sync>` wrapper is replaced by plain `Arc<dyn Error + Send + Sync>` (`DynError`), eliminating the lifetime parameter and unnecessary indirection. - Delete `packages/located-error/` (crate, LICENSE, README) - Remove workspace member and dependency from `Cargo.toml` - Simplify error variants in `config::Error` and `web::api::server::Error` - Emit `tracing::error!` events where `LocatedError` previously logged See ADR-T-004 for rationale.
There was a problem hiding this comment.
Pull request overview
This PR prepares the workspace for the next major release by removing the internal torrust-index-located-error crate (moving error-origin context to tracing) and migrating the entire workspace to Rust edition 2024 (including an MSRV bump and dependency updates).
Changes:
- Remove the
packages/located-errorworkspace member and replaceLocatedErrorusages withDynError+tracinglogging. - Migrate workspace to
edition = "2024", raiserust-versionto1.85, and bump workspace version to4.0.0-develop. - Update key dependencies (e.g.,
jsonwebtokenv10,randv0.10) and apply rustfmt/import reordering and small lint-driven edits.
Reviewed changes
Copilot reviewed 66 out of 68 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/upgrades/from_v1_0_0_to_v2_0_0/upgrader.rs | Import reordering for edition-2024 formatting. |
| tests/upgrades/from_v1_0_0_to_v2_0_0/sqlite_v2_0_0.rs | Import reordering. |
| tests/upgrades/from_v1_0_0_to_v2_0_0/sqlite_v1_0_0.rs | Import reordering. |
| tests/environments/isolated.rs | Import reordering. |
| tests/environments/app_starter.rs | Import reordering. |
| tests/e2e/web/api/v1/contexts/user/contract.rs | Import reordering. |
| tests/e2e/web/api/v1/contexts/torrent/steps.rs | Import reordering. |
| tests/e2e/web/api/v1/contexts/torrent/contract.rs | rustfmt-driven test signature formatting change. |
| tests/e2e/environment.rs | Import reordering. |
| tests/common/random.rs | rand API migration (Rng → RngExt). |
| tests/common/contexts/user/fixtures.rs | rand API migration (Rng → RngExt). |
| tests/common/contexts/torrent/fixtures.rs | Import reordering. |
| tests/common/contexts/tag/fixtures.rs | rand API migration (Rng → RngExt). |
| tests/common/contexts/category/fixtures.rs | rand API migration (Rng → RngExt). |
| tests/common/client.rs | Import reordering. |
| src/web/api/server/v1/routes.rs | Import reordering. |
| src/web/api/server/v1/responses.rs | Import reordering. |
| src/web/api/server/v1/contexts/user/routes.rs | Import reordering. |
| src/web/api/server/v1/contexts/user/handlers.rs | Import reordering. |
| src/web/api/server/v1/contexts/torrent/routes.rs | Import reordering. |
| src/web/api/server/v1/contexts/torrent/responses.rs | Import reordering. |
| src/web/api/server/v1/contexts/torrent/handlers.rs | Remove edition-2024 lint allow + import reordering. |
| src/web/api/server/v1/contexts/torrent/errors.rs | Import reordering + string formatting wrap. |
| src/web/api/server/v1/contexts/tag/routes.rs | Import reordering. |
| src/web/api/server/v1/contexts/settings/routes.rs | Import reordering. |
| src/web/api/server/v1/contexts/proxy/routes.rs | Import reordering. |
| src/web/api/server/v1/contexts/proxy/responses.rs | Import reordering. |
| src/web/api/server/v1/contexts/category/routes.rs | Import reordering. |
| src/web/api/server/v1/contexts/category/handlers.rs | Import reordering. |
| src/web/api/server/v1/contexts/about/routes.rs | Import reordering. |
| src/web/api/server/v1/contexts/about/handlers.rs | Import reordering. |
| src/web/api/server/mod.rs | Replace LocatedError with DynError and log TLS config errors via tracing. |
| src/web/api/server/custom_axum.rs | Import reordering. |
| src/web/api/client/v1/random.rs | rand API migration (Rng → RngExt). |
| src/web/api/client/v1/http.rs | Import reordering. |
| src/web/api/client/v1/client.rs | Import reordering. |
| src/utils/parse_torrent.rs | Import reordering. |
| src/upgrades/from_v1_0_0_to_v2_0_0/databases/sqlite_v2_0_0.rs | Import reordering. |
| src/upgrades/from_v1_0_0_to_v2_0_0/databases/sqlite_v1_0_0.rs | Import reordering. |
| src/ui/proxy.rs | Import reordering. |
| src/tests/services/settings.rs | Import reordering. |
| src/tests/models/user.rs | Import reordering. |
| src/tests/config/mod.rs | Import reordering within tests. |
| src/tests/cache/bytes_cache.rs | rustfmt-driven test signature formatting change. |
| src/services/user.rs | Dependency import reordering + small formatting changes. |
| src/services/torrent.rs | Import reordering. |
| src/services/authentication.rs | Dependency import reordering for jsonwebtoken v10. |
| src/mailer.rs | Dependency import reordering for jsonwebtoken v10 + minor import reorder. |
| src/lib.rs | Small formatting change (condensed if expression). |
| src/databases/sqlite.rs | Import reordering. |
| src/databases/mysql.rs | Import reordering. |
| src/console/cronjobs/tracker_statistics_importer.rs | Import reordering. |
| src/config/v2/mod.rs | Import reordering. |
| src/config/mod.rs | Replace LocatedError with DynError and add tracing logging in conversion. |
| src/bin/parse_torrent.rs | rustfmt wrapping of long eprintln!. |
| src/app.rs | Import reordering. |
| README.md | Add links to ADR-T-004 and ADR-T-005. |
| packages/render-text-as-image/src/tests/mod.rs | Import reordering. |
| packages/render-text-as-image/src/render.rs | Import reordering. |
| packages/render-text-as-image/examples/test_render.rs | Import reordering. |
| packages/located-error/src/lib.rs | Deleted crate source (workspace member removed). |
| packages/located-error/README.md | Deleted crate README. |
| packages/located-error/LICENSE | Deleted crate license file. |
| packages/located-error/Cargo.toml | Deleted crate manifest. |
| Cargo.toml | Remove workspace member + bump edition/MSRV/version + dependency updates + stricter 2024 compatibility lints. |
| Cargo.lock | Lockfile churn from dependency and edition/MSRV updates. |
| adr/004-remove-located-error.md | New ADR documenting removal of located-error crate. |
| adr/005-edition-2024.md | New ADR documenting edition-2024 migration and remaining dependency pins. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #839 +/- ##
===========================================
+ Coverage 52.18% 52.20% +0.02%
===========================================
Files 117 116 -1
Lines 6205 6166 -39
Branches 6205 6166 -39
===========================================
- Hits 3238 3219 -19
+ Misses 2887 2866 -21
- Partials 80 81 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
BREAKING CHANGE: MSRV raised from 1.83 to 1.85; workspace version bumped from 3.1.0-develop to 4.0.0-develop. Edition migration ----------------- - Set `edition = "2024"` workspace-wide. - Raise `rust-version` to 1.85. - Promote `rust-2024-compatibility` lint group from `warn` to `deny`. - Remove `#[allow(if_let_rescope)]` in torrent handlers (native in edition 2024). - Relax `located-error` doctest assertion from `"lib.rs"` to `".rs"` to accommodate edition 2024 merged-doctest bundling. - Apply `cargo fmt` import reordering (edition 2024 style) across ~55 files. Dependency upgrades ------------------- - `jsonwebtoken`: 9.3 → 10 (with `rust_crypto` feature). - `rand`: 0.9 → 0.10; rename `use rand::Rng` to `use rand::RngExt` in 5 files. Cargo.lock pins still required for MSRV 1.85 --------------------------------------------- - `simple_asn1` 0.6.3 (0.6.4 requires `time ^0.3.47`) - `time` 0.3.45, `time-core` 0.1.7, `time-macros` 0.2.25, `num-conv` 0.1.0 (0.3.47+ requires Rust 1.88) - `psm` 0.1.24 (0.1.30 pulls `ar_archive_writer` with unstable `let` expressions) See ADR-T-004 for full rationale and pin-maintenance instructions.
2981b15 to
ed58e78
Compare
|
ACK ed58e78 |
Summary
This PR completes two related housekeeping tasks that prepare the codebase for the next major release cycle:
Remove the
located-errorpackage — The first-partytorrust-index-located-errorcrate is replaced by directtracing::error!calls at error-construction sites. Error types inconfigandweb::api::serverare simplified fromLocatedError<'static, dyn Error + Send + Sync>to plainArc<dyn Error + Send + Sync>(DynError), eliminating a lifetime parameter and unnecessaryArcindirection. (See ADR-T-004.)Migrate the entire workspace to Rust edition 2024 — The edition is bumped from 2021 to 2024, the MSRV is raised from 1.83 to 1.85, and the workspace version goes from
3.1.0-developto4.0.0-develop. Key dependency upgrades includejsonwebtoken9.3 → 10,rand0.9 → 0.10, and therust-2024-compatibilitylint group is promoted fromwarntodeny. Import ordering across ~55 files is reformatted to edition-2024 style. (See ADR-T-005.)Breaking Changes
4.0.0-developto reflect the edition change and removed package.located-errorcrate removed — any downstream code depending ontorrust-index-located-errormust migrate totracingor plain error types.Dependency Pin Status
Most transitive pins from ADR-T-003 have been lifted thanks to the MSRV-aware resolver in edition 2024. A handful of pins remain for the
timefamily andpsmuntil their upstream crates support Rust 1.85 (details in ADR-T-005).Scope
68 files changed, ~920 insertions, ~1120 deletions (net reduction). The bulk of the diff is the deleted
located-errorpackage, Cargo.lock churn from dependency upgrades, and mechanical import reordering bycargo fmt.