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
Update cargo submodule 29 commits in 59800466c5c41c444d264b1010b4d57e85a7117f..3efb1f477e99b42974b982d939fd100303cdf7db 2026-07-07 15:52:22 +0000 to 2026-07-17 23:53:19 +0000 - refactor(context): normalize in `homedir` instead (rust-lang/cargo#17222) - chore(ci): reflect doc folder move in book deployment (rust-lang/cargo#17235) - refactor(ops): Have cargo-metadata's ops match the command name (rust-lang/cargo#17233) - chore: Flatten src (rust-lang/cargo#17231) - chore: Flatten `src` (rust-lang/cargo#17230) - chore(ci): remove stale libsecret packages (rust-lang/cargo#17229) - perf: Lazily initialize git2 fetch transports (rust-lang/cargo#17226) - test(trim-paths): re-enable lldb debugger tests (rust-lang/cargo#17223) - Include SBOM outputs in fingerprints (rust-lang/cargo#17216) - Update cfg_aliases to 0.2.2 (rust-lang/cargo#17225) - test(trim-paths): exercise GDB on windows-gnu (rust-lang/cargo#17221) - feat(profile): Disable incremental compilation under CI by default (rust-lang/cargo#17220) - Remove myself from review rotation (rust-lang/cargo#17219) - Fix typo in comment in sync (rust-lang/cargo#17217) - docs(ref): Improve handing of built-in profiles (rust-lang/cargo#17213) - fix: dont apply host-config gating to stable behavior (rust-lang/cargo#17198) - chore(deps): update msrv (rust-lang/cargo#17192) - test: fix race in cargo_compile_with_invalid_code_in_deps (rust-lang/cargo#17203) - Rename `-Zno-embed-metadata` to `-Zembed-metadata=no` (rust-lang/cargo#17149) - fix(source): incorrect duplicate package warning (rust-lang/cargo#17204) - Fix manifest schema generation: `TomlDebugInfo` enum-variants doesn't renamed (rust-lang/cargo#17202) - Reduce library search path length in new build dir layout (rust-lang/cargo#17191) - fix(install): Move --debug to Compilation options (rust-lang/cargo#17199) - chore(ci): dogfood `build.warnings` (rust-lang/cargo#17195) - docs(lints): Better match clippy in lint section titles (rust-lang/cargo#17190) - chore: bump to 0.100.0; update changelog (rust-lang/cargo#17189) - docs(ref): Clarify MSRV for lints (rust-lang/cargo#17184) - docs(report): add missing entry for `cargo report future-incompatibilities` (rust-lang/cargo#17188) - Reduce rustc `-L` args used in the new `build-dir` layout (rust-lang/cargo#17168)
Update cargo submodule 29 commits in 59800466c5c41c444d264b1010b4d57e85a7117f..3efb1f477e99b42974b982d939fd100303cdf7db 2026-07-07 15:52:22 +0000 to 2026-07-17 23:53:19 +0000 - refactor(context): normalize in `homedir` instead (rust-lang/cargo#17222) - chore(ci): reflect doc folder move in book deployment (rust-lang/cargo#17235) - refactor(ops): Have cargo-metadata's ops match the command name (rust-lang/cargo#17233) - chore: Flatten src (rust-lang/cargo#17231) - chore: Flatten `src` (rust-lang/cargo#17230) - chore(ci): remove stale libsecret packages (rust-lang/cargo#17229) - perf: Lazily initialize git2 fetch transports (rust-lang/cargo#17226) - test(trim-paths): re-enable lldb debugger tests (rust-lang/cargo#17223) - Include SBOM outputs in fingerprints (rust-lang/cargo#17216) - Update cfg_aliases to 0.2.2 (rust-lang/cargo#17225) - test(trim-paths): exercise GDB on windows-gnu (rust-lang/cargo#17221) - feat(profile): Disable incremental compilation under CI by default (rust-lang/cargo#17220) - Remove myself from review rotation (rust-lang/cargo#17219) - Fix typo in comment in sync (rust-lang/cargo#17217) - docs(ref): Improve handing of built-in profiles (rust-lang/cargo#17213) - fix: dont apply host-config gating to stable behavior (rust-lang/cargo#17198) - chore(deps): update msrv (rust-lang/cargo#17192) - test: fix race in cargo_compile_with_invalid_code_in_deps (rust-lang/cargo#17203) - Rename `-Zno-embed-metadata` to `-Zembed-metadata=no` (rust-lang/cargo#17149) - fix(source): incorrect duplicate package warning (rust-lang/cargo#17204) - Fix manifest schema generation: `TomlDebugInfo` enum-variants doesn't renamed (rust-lang/cargo#17202) - Reduce library search path length in new build dir layout (rust-lang/cargo#17191) - fix(install): Move --debug to Compilation options (rust-lang/cargo#17199) - chore(ci): dogfood `build.warnings` (rust-lang/cargo#17195) - docs(lints): Better match clippy in lint section titles (rust-lang/cargo#17190) - chore: bump to 0.100.0; update changelog (rust-lang/cargo#17189) - docs(ref): Clarify MSRV for lints (rust-lang/cargo#17184) - docs(report): add missing entry for `cargo report future-incompatibilities` (rust-lang/cargo#17188) - Reduce rustc `-L` args used in the new `build-dir` layout (rust-lang/cargo#17168)
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