Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 84864bf

Browse files
committedJan 25, 2021
Auto merge of #81380 - pietroalbini:cargo-pgo-lockfile, r=Mark-Simulacrum
Use the monorepo's lockfile when building cargo for PGO profiling Fixes #81378. The description of the problem and the reasoning for the fix is in the source code comments. r? `@Mark-Simulacrum`
2 parents d3163e9 + b2e6f33 commit 84864bf

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
 

‎src/ci/pgo.sh

+14
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@ pgo_perf_benchmark ctfe-stress-4
2424

2525
cp -pri ../src/tools/cargo /tmp/cargo
2626

27+
# The Cargo repository does not have a Cargo.lock in it, as it relies on the
28+
# lockfile already present in the rust-lang/rust monorepo. This decision breaks
29+
# down when Cargo is built outside the monorepo though (like in this case),
30+
# resulting in a build without any dependency locking.
31+
#
32+
# To ensure Cargo is built with locked dependencies even during PGO profiling
33+
# the following command copies the monorepo's lockfile into the Cargo temporary
34+
# directory. Cargo will *not* keep that lockfile intact, as it will remove all
35+
# the dependencies Cargo itself doesn't rely on. Still, it will prevent
36+
# building Cargo with arbitrary dependency versions.
37+
#
38+
# See #81378 for the bug that prompted adding this.
39+
cp -p ../Cargo.lock /tmp/cargo
40+
2741
# Build cargo (with some flags)
2842
function pgo_cargo {
2943
RUSTC=./build/$PGO_HOST/stage2/bin/rustc \

0 commit comments

Comments
 (0)
Failed to load comments.