You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the profile-overrides feature to optimize one specific crate in my workspace, like this:
[workspace]
members = ["base-crate", "user-crate", "opt-pkg"]
# This allows us to optimize dependencies# If you aren't on nightly, you can just comment this out.
[profile.dev.overrides."*"]
opt-level = 3# Also optimize opt-pkg# Per default, workspace members are not included by "*".
[profile.dev.overrides.opt-pkg]
opt-level = 3
base-crate depends on no crate from the workspace, while the other two depend on base-crate and user-crate depends on opt-pkg. base-crate also has a binary target.
This works nicely so far. When I do cargo run -p base-crate though, I get this warning:
warning: profile override spec `opt-pkg` did not match any packages
Nothing bad happens but IMO the warning is redundant. You don't get the warning when doing cargo run -p user-crate as it depends on opt-pkg. I think this is because only the resolution DAG of the package built is used. The warning should only fire if the crate can't be found in all of Cargo.lock (combined resolution DAG for all workspace crates).
The problem is that it needs the full workspace resolve from this code path. I don't see a way to access that from the existing resolve.
Maybe that function should return two resolvers (the "full" one, and the minimal one)?
Or maybe merge_from could add a new field to Resolve to track the "workspace-wide" set of packages (it just needs PackageIds)? I'm not sure how fragile that will be with options like -Zavoid-dev-deps.
I don't have a good sense of how workspaces interact with the resolver, but I think we have several bugs related to different folders in a workspace seeing different resolutions. So having a workspace-resolution sounds like it makes sense.
I'm using the profile-overrides feature to optimize one specific crate in my workspace, like this:
base-crate
depends on no crate from the workspace, while the other two depend onbase-crate
anduser-crate
depends onopt-pkg
.base-crate
also has a binary target.This works nicely so far. When I do
cargo run -p base-crate
though, I get this warning:Nothing bad happens but IMO the warning is redundant. You don't get the warning when doing
cargo run -p user-crate
as it depends on opt-pkg. I think this is because only the resolution DAG of the package built is used. The warning should only fire if the crate can't be found in all of Cargo.lock (combined resolution DAG for all workspace crates).cc rust-lang/rust#48683
The text was updated successfully, but these errors were encountered: