Reduce rustc -L args used in the new build-dir layout#17168
Conversation
|
r? @epage rustbot has assigned @epage. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Maybe as another optimization (because each dependency with a build script will generate two |
a6fc9f2 to
b6b1b73
Compare
|
I think that another rustc --crate-name foo --edition=2024 src/main.rs --crate-type bin
--emit=dep-info,link -C embed-bitcode=no -C debuginfo=2
--out-dir /tmp/foo/target/debug/build/foo/ea1ee4071e58254b/out
-C incremental=/tmp/foo/target/debug/incremental
-L dependency=/tmp/foo/target/debug/build/aho-corasick/c53d038be9b9715d/out
-L dependency=/tmp/foo/target/debug/build/anstream/4bdda5cd8d2978b2/out
-L dependency=/tmp/foo/target/debug/build/log/a7c7b57a5f6aeb19/out
-L dependency=/tmp/foo/target/debug/build/env_logger/c5ba55a17507a07e/out
--extern env_logger=/tmp/foo/target/debug/build/env_logger/c5ba55a17507a07e/out/libenv_logger-c5ba55a17507a07e.rlib
--extern log=/tmp/foo/target/debug/build/log/a7c7b57a5f6aeb19/out/liblog-a7c7b57a5f6aeb19.rlibNotice how cargo passes both So if that is the case, we could skip each |
|
I tested it both with depending on |
f8dc895 to
11e2dd5
Compare
This comment has been minimized.
This comment has been minimized.
11e2dd5 to
62ecc64
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
dont merge this yet, I am still testing it and I think there might be some issues hidden in other tests since @rustbot author |
62ecc64 to
c28162c
Compare
Oh interesting, I am not sure. That sounds like a reasonable optimization we could make if we indeed don't need to depend on anything through |
|
I tried removing I finished checking the remaining tests and I believe the latest version is now correct and all of the tests pass. @rustbot ready |
c28162c to
73f20c2
Compare
What does this PR try to resolve?
With the new
build-direnabled in rust-lang/rust there are have been a few reported issues due to long commands / PATH.This PR attempts to mitigate this by doing the following:
add_dep_argfn).[build-dependencies]the build-script unit depended on.I included this both in the PR as they are small and related but happy to split into dedicated PRs if desired :)
How to test and review this PR?
See the included tests. Best reviewed commit by commit
cc: @Kobzol