Skip to content
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

Failure to bundle duplicate named targets under Virtual Workspace #204

Open
tayu0110 opened this issue Jan 1, 2024 · 0 comments
Open

Failure to bundle duplicate named targets under Virtual Workspace #204

tayu0110 opened this issue Jan 1, 2024 · 0 comments

Comments

@tayu0110
Copy link

tayu0110 commented Jan 1, 2024

I always use cargo-eqiup for competitive programming contests.

I want to make the following workspace

$ tree -I "target" .
.
├── Cargo.lock
├── Cargo.toml
├── first-crate
│   ├── Cargo.toml
│   └── src
│       ├── bin
│       │   └── a.rs
│       └── main.rs
└── second-crate
    ├── Cargo.toml
    └── src
        ├── bin
        │   └── a.rs
        └── main.rs
$ cat ./Cargo.toml
[workspace]
members = ["first-crate", "second-crate"]
resolver = "2"

first-crate and second-crate are the crates for each contests.

In first-crate (or second-crate), when I execute cargo equip --bin a, the following result appears.

error: multiple bin targets named `a` in this workspace

On the other hand, cargo run --bin a and cargo build --bin a succeed.
Is this expected behavior ?

If not, I would like suggest the following change

  • change workspace::targets_in_ws's return value to the targets in Metadata::root_package()

It seems that cargo run selects the targets in the current package, if neither --package, --exclude, --workspace nor --all flags are specified.
Since cargo-equip does not have these flags, I believe the natural behavior would be to select targets only from the current package rather than scanning all members in the workspace.

Thank you for your confirming.
Best Regard.

My Environment

$ cargo --version
cargo 1.75.0 (1d8b05cdd 2023-11-20)
$ rustc --version
rustc 1.75.0 (82e1608df 2023-12-21)
$ cargo equip --version
cargo-equip 0.20.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant