Problem
I've seen numerous issues related to this warning, however I believe I've found a bug with it. I have two binaries listed in my [[bin]] table, each with a different main file. When one of the files is in the tests directory, the warning surfaces. However when both files are under src, there is no warning. Cargo seems to be complaining about a non-problematic usage of the binary table. Please see example in repro section.
Steps
Configuration 1: Warning occurs when test_server.rs lives in tests directory.
[package]
name = "example"
version = "0.1.0"
edition = "2021"
[[bin]]
name = "example"
path = "src/server.rs"
[[bin]]
name = "example-for-test"
path = "tests/test_server.rs"
├── Cargo.lock
├── Cargo.toml
├── src
│ └── server.rs
└── tests
└── test_server.rs
$ cargo check
warning: file found to be present in multiple build targets: /private/tmp/example/tests/test_server.rs
Checking example v0.1.0 (/private/tmp/example)
Finished dev [unoptimized + debuginfo] target(s) in 0.39s
Configuration 2: Warning not raised when test_server.rs is placed in src.
[package]
name = "example"
version = "0.1.0"
edition = "2021"
[[bin]]
name = "example"
path = "src/server.rs"
[[bin]]
name = "example-for-test"
path = "src/test_server.rs"
[dependencies]
.
├── Cargo.lock
├── Cargo.toml
├── src
│ ├── server.rs
│ └── test_server.rs
└── tests
$ cargo check
Checking example v0.1.0 (/private/tmp/example)
Finished dev [unoptimized + debuginfo] target(s) in 0.38s
Possible Solution(s)
No response
Notes
No response
Version
cargo 1.63.0 (fd9c4297c 2022-07-01)
Problem
I've seen numerous issues related to this warning, however I believe I've found a bug with it. I have two binaries listed in my [[bin]] table, each with a different main file. When one of the files is in the
testsdirectory, the warning surfaces. However when both files are undersrc, there is no warning. Cargo seems to be complaining about a non-problematic usage of the binary table. Please see example in repro section.Steps
Configuration 1: Warning occurs when
test_server.rslives intestsdirectory.Configuration 2: Warning not raised when
test_server.rsis placed insrc.Possible Solution(s)
No response
Notes
No response
Version