Cargo panic: did not find features for axum_test within activated_features

I am building a rust binary inside a docker container (rust:1, precisely rustc 1.86.0 (05f9846f8 2025-03-31)), but cargo panics when building the binary.

thread 'main' panicked at src/tools/cargo/src/cargo/core/resolver/features.rs:325:13:
did not find features for (PackageId { name: "axum-test", version: "17.3.0", source: "registry `crates-io`" }, NormalOrDev) within activated_features:

The Cargo.toml:

[package]
name = "homeworks"
version = "0.1.0"
edition = "2021"

[dependencies]
axum = "0.8.1"
chrono = { version = "0.4.39", features = ["serde"] }
color-eyre = "0.6.3"
diesel = { version = "2.2.7", features = ["chrono"], default-features = false }
diesel-async = { version = "0.5.2", features = ["postgres", "bb8", "async-connection-wrapper"] }
diesel_full_text_search = { version = "2.2.0", default-features = false }
diesel_migrations = "2.2.0"
dotenvy = "0.15.7"
envy = "0.4.2"
futures-util = "0.3.31"
icalendar = "0.16.13"
rustls = "0.23.25"
rustls-platform-verifier = "0.5.1"
serde = { version = "1.0.217", features = ["derive"] }
tokio = { version = "1.43.0", features = ["full"] }
tokio-postgres = "0.7.13"
tokio-postgres-rustls = "0.13.0"
tower-http = { version = "0.6.2", features = ["fs"] }
tracing = "0.1.41"
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
utoipa = { version = "5.3.1", features = ["chrono", "axum_extras"] }
utoipa-axum = "0.2.0"
utoipa-swagger-ui = { version = "9.0.0", features = ["axum"] }

[dev-dependencies]
axum-test = "17.3.0"
serde_json = "1.0.140"

The Dockerfile:

FROM rust:1 AS backend

WORKDIR /app

RUN cargo install cargo-build-deps && \
    cargo new --bin homeworks

WORKDIR /app/homeworks

COPY Cargo.toml Cargo.lock ./
RUN cargo build-deps --release

COPY src ./src
COPY migrations ./migrations

RUN cargo build --release && \
    strip target/release/homeworks

The panic doesn't happen on my host machine, which is running Arch Linux with the same rust version.

Does it work if you remove the build-deps step from the docker file?

Everything works when running only cargo build --release. I will report this bug to cargo-build-deps in that case.

The project doesn't seem to be maintained. If that's the case, I would recommend you to use cargo chef instead.