Skip to content

cargo build --all-targets generates two copies of crate test binary #4929

@rocallahan

Description

@rocallahan

Example:

[roc@glory ~]$ cargo new foobar
     Created library `foobar` project
[roc@glory ~]$ cd foobar/
[roc@glory foobar]$ cargo build --all-targets
   Compiling foobar v0.1.0 (file:///home/roc/foobar)
    Finished dev [unoptimized + debuginfo] target(s) in 0.45 secs
[roc@glory foobar]$ ls target/debug/
build  examples                 foobar-149b726de0cb9a4e.d  foobar-d74fc8c2632ddb7a.d  libfoobar.d     native
deps   foobar-149b726de0cb9a4e  foobar-d74fc8c2632ddb7a    incremental                libfoobar.rlib
[roc@glory foobar]$ target/debug/foobar-149b726de0cb9a4e 

running 1 test
test tests::it_works ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

[roc@glory foobar]$ target/debug/foobar-d74fc8c2632ddb7a 

running 1 test
test tests::it_works ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

[roc@glory foobar]$ 

I don't know why it generates two copies of the crate test binary. That seems unnecessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions