-
Notifications
You must be signed in to change notification settings - Fork 898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cargo fmt
does not handle workspace member "Cargo.toml" being a symlink; gives error "Failed to find targets"
#6184
Comments
Rustfmt has its own repository. @bors transfer rustfmt |
@rustbot transfer rustfmt |
The issue occurs due to use of
The use is in Lines 388 to 389 in c97996f
The |
The canonicalize() function resolves symlinks, which would cause targets whose "Cargo.toml" is a symlink to be filtered out. This would cause `cargo-fmt` to print an error "Failed to find targets". Resolves rust-lang#6184
Unrelated to fixing this, I'm curious what use cases people have for symlinking |
I have a comment on the "path_bases" RFC that goes into detail: rust-lang/rfcs#3529 (comment) My company has a custom external build system that calls To workaround this, our build system currently:
Example
|
Problem
If a cargo workspace has a member project whose
Cargo.toml
is a symlink to a validCargo.toml
, then runningcargo fmt
from the member directory fails with:Here's a diff with a simple workspace that reproduces the issue.
You can
git apply
in an empty Git repo:Steps
Cargo.toml
to a symlinkcd
into member project directory from previous stepcargo fmt
Notes
Interestingly, even if all of the
Cargo.toml
files are symlinks, the issue does not occur when runningcargo fmt
from the root of the workspace.Version
This occurs on the latest stable and nightly versions of
rustfmt
as of submitting:(Migrated from rust-lang/cargo#14012 since
cargo-fmt
lives in rust repo, not cargo repo)The text was updated successfully, but these errors were encountered: