Vendored cargo warns cargo_multi_version_old_cargo ("declares no rust-version") when the root package inherits rust-version from [workspace.package]
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 84/100
Línea de trabajo
Comienza en crates/socket-patch-core/src/vendor/cargo.rs:90-99, en declared_cargo_minor, y luego inspecciona crates/socket-patch-cli/tests/e2e_vendor_cargo_build.rs y su fixture stage_two_versions. Reproduce el caso de rust-version heredado y añade cobertura que muestre que se reconoce la herencia del workspace, mientras que el control no-rust-version sigue mostrando una advertencia. Se considera terminado cuando el caso de workspace heredado ya no emite cargo_multi_version_old_cargo.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
[agent] Found by the scheduled Cargo bug-hunt routine (ledger #315).
Summary
When a second version of one crate is vendored, vendor decides whether to emit cargo_multi_version_old_cargo by reading the project's declared cargo floor (declared_cargo_minor). A workspace-root manifest whose [package] inherits the floor with rust-version.workspace = true (and [workspace.package] rust-version = "1.70") is treated as declaring nothing. The project gets the warning, and the warning says it "declares no rust-version or toolchain, so the cargo that builds it is unknown".
The cause: [package].rust-version is present but is a table ({ workspace = true }), not a string. .get("rust-version") returns Some(table), so the .or_else fallback to [workspace.package].rust-version never runs, and then .as_str() yields None.
Impact
Low severity. It's a false, misleading warning, not a broken build. The build is fine. Workspace inheritance needs cargo 1.64+, so any project using rust-version.workspace = true already can't be built by the pre-1.45 cargo the warning is about. Root packages that inherit from [workspace.package] are the standard modern workspace layout, so every multi-version vendor in such a project emits a spurious warning, which trains users to ignore it.
Repro
This used a scratch copy of crates/socket-patch-cli/tests/e2e_vendor_cargo_build.rs (stage_two_versions fixture: cfg-if 1.x plus cfg_if_old = { package = "cfg-if", version = "0.1" }, a marker patch per version, and the prebuilt_common artifact server). Only the root Cargo.toml was swapped, then I ran socket-patch vendor --json --offline:
[workspace]
[workspace.package]
rust-version = "1.70"
[package]
name = "consumer"
version = "0.1.0"
edition = "2018"
rust-version.workspace = true
[dependencies]
cfg-if = "1.0"
cfg_if_old = { package = "cfg-if", version = "0.1" }
root Cargo.toml shape |
cargo build --locked before |
vendor exit |
cargo_multi_version_old_cargo |
cargo run --locked --offline after |
|---|---|---|---|---|
rust-version = "1.70" in [package] |
ok | 0 | no (correct) | MARKER:1:2 |
rust-version.workspace = true + [workspace.package] rust-version = "1.70" |
ok | 0 | yes (wrong) | MARKER:1:2 |
BOM + rust-version = "1.70" |
ok | 0 | no (correct) | MARKER:1:2 |
no rust-version (control) |
ok | 0 | yes (correct) | MARKER:1:2 |
I ran the scratch test twice with identical results. The warning text on the inherited shape:
cfg-if is now vendored at TWO versions (… beside …), which needs cargo 1.45 or newer — this project declares no
rust-versionor toolchain, so the cargo that builds it is unknown. …
Expected vs actual
- Expected. CLI_CONTRACT.md (cargo vendored row) says "a project that does not pin cargo ≥ 1.45 (
rust-versionor toolchain file) gets thecargo_multi_version_old_cargowarning", and docs/ecosystems.md says the warning is skipped when "the project'srust-version… promises cargo 1.45+". The doc comment ondeclared_cargo_minorreads "[package], else[workspace.package]". This project does pin 1.70, through cargo's documented inheritance, so it should get no warning. - Actual. The warning fires and claims the project declares no
rust-version.
OS × version
| OS | cargo | result |
|---|---|---|
| Linux (sandbox) | 1.93.1 | fail (reproduced twice) |
| macOS / Windows | — | untested (pure manifest parsing, so no OS dependence is expected) |
Main 045d7ec (CLI 4.0.0). I didn't bisect this: the multi-version warning was added with the v5 manifest wiring.
Suspect code
crates/socket-patch-core/src/vendor/cargo.rs:90-99 (declared_cargo_minor): doc.get("package").and_then(|p| p.get("rust-version")).or_else(...) short-circuits on the { workspace = true } table. Treat a non-string [package].rust-version (or rust-version.workspace = true) as "look in [workspace.package]". Optionally, treat any use of workspace inheritance as proof of cargo ≥ 1.64.
- Lenguaje dominante
- Rust
- Estrellas
- 8
- Forks
- 0
- Merge medio
- 1 d 7 min
- PR fusionados (30 d)
- 178
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de SocketDev/socket-patch
-
Hosted yarn classic pins give no berry-migration warning, so a yarn 2+ install silently drops them (vendored warns about the same trap)Posiblemente ocupada @mikolalysenko la tomó hoy. Abiertoagent:claimed agent:triaged bug bughunt pm:yarn-classic priority:p1
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
SocketDev/socket-patch#907 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
agent:triaged bug bughunt pm:npm priority:p1
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
SocketDev/socket-patch#900 ·
Los mantenedores suelen responder en 1 día
-
agent:triaged bug bughunt pm:bundler priority:p1
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
SocketDev/socket-patch#896 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
agent:triaged bug bughunt pm:yarn-berry priority:p1
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
SocketDev/socket-patch#783 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
agent:triaged bug bughunt pm:pipenv priority:p1
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
SocketDev/socket-patch#744 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de SocketDev/socket-patch
Issues similares
-
Signals (Failure Detector): a tool call and its own execution are reported as a repeated callAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
check: a failed re-read of the model file before binding is labelled E_THETA_LEVEL_BINDING on [parameters]Posiblemente ocupada @TeunP la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 80/100
Devolutions/picky-rs#546 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día