-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Labels
C-bugCategory: bugCategory: bugS-triageStatus: This issue is waiting on initial triage.Status: This issue is waiting on initial triage.
Description
Problem
cargo publish --workspace --dry-run
fails to run on dependent crates.
Here is a minimal example with 2 crates.
tree
.
├── a
│ ├── Cargo.toml
│ └── src
│ └── lib.rs
├── b
│ ├── Cargo.toml
│ └── src
│ └── lib.rs
├── Cargo.lock
└── Cargo.toml
a/Cargo.toml
:
[package]
name = "a"
version = "0.1.0"
edition = "2024"
[dependencies]
b = { version = "0.1.0", path = "../b" }
a/src/lib.rs
:
pub fn hello() {
b::hello()
}
b/Cargo.toml
:
[package]
name = "b"
version = "0.1.0"
edition = "2024"
[dependencies]
b/src/lib.rs
:
pub fn hello() {
println!("Hello, world!");
}
Steps
cargo build
in the workspace, works as expeced.cargo publish --workspace --dry-run --allow-dirty
fails with the following output
cargo publish --workspace --dry-run --allow-dirty
Updating crates.io index
warning: crate a@0.1.0 already exists on crates.io index
warning: crate b@0.1.0 already exists on crates.io index
warning: manifest has no description, license, license-file, documentation, homepage or repository.
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
Packaging b v0.1.0 (/home/t-moe/test_workspace/b)
Packaged 5 files, 1.1KiB (814B compressed)
warning: manifest has no description, license, license-file, documentation, homepage or repository.
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
Packaging a v0.1.0 (/home/t-moe/test_workspace/a)
Updating crates.io index
Packaged 5 files, 1.3KiB (932B compressed)
Verifying b v0.1.0 (/home/t-moe/test_workspace/b)
Compiling b v0.1.0 (/home/t-moe/test_workspace/target/package/b-0.1.0)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.30s
Verifying a v0.1.0 (/home/t-moe/test_workspace/a)
warning: a v0.1.0 (/home/t-moe/test_workspace/target/package/a-0.1.0) ignoring invalid dependency `b` which is missing a lib target
Compiling a v0.1.0 (/home/t-moe/test_workspace/target/package/a-0.1.0)
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `b`
--> src/lib.rs:2:5
|
2 | b::hello()
| ^ use of unresolved module or unlinked crate `b`
|
= help: if you wanted to use a crate named `b`, use `cargo add b` to add it to your `Cargo.toml`
For more information about this error, try `rustc --explain E0433`.
error: could not compile `a` (lib) due to 1 previous error
error: failed to verify package tarball
What am I missing? Must be a stupid error...
Possible Solution(s)
No response
Notes
No response
Version
cargo 1.90.0 (840b83a10 2025-07-30)
release: 1.90.0
commit-hash: 840b83a10fb0e039a83f4d70ad032892c287570a
commit-date: 2025-07-30
host: x86_64-unknown-linux-gnu
libgit2: 1.9.1 (sys:0.20.2 vendored)
libcurl: 8.14.1-DEV (sys:0.4.82+curl-8.14.1 vendored ssl:OpenSSL/3.5.0)
ssl: OpenSSL 3.5.0 8 Apr 2025
os: Ubuntu 24.4.0 (noble) [64-bit]
rain2307
Metadata
Metadata
Assignees
Labels
C-bugCategory: bugCategory: bugS-triageStatus: This issue is waiting on initial triage.Status: This issue is waiting on initial triage.