Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Experiment] Replace crate-hash with simple timestamp. #94852

Closed

Conversation

michaelwoerister
Copy link
Member

This might be a nice simplification that make things more robust and would probably also simplify any work on end-to-end queries. Let's see what performance looks like.

r? @ghost

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 11, 2022
@rust-log-analyzer

This comment has been minimized.

@michaelwoerister
Copy link
Member Author

It looks like it's not that trivial to make this pass all tests. But let's see if we can get a build for perf.rlo.

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 11, 2022
@bors
Copy link
Contributor

bors commented Mar 11, 2022

⌛ Trying commit 59f269c with merge 9fc5ba51a036e587a8b4be991f470bd2d268a87b...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-12 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Finished release [optimized] target(s) in 11.12s
Check compiletest suite=run-make-fulldeps mode=run-make (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 229 tests
..........i.ii....ii............F........F...........................F.............................. 100/229
.................i...................iiiiiii......i...................iii........................... 200/229
.......F...ii...........F....
Some tests failed in compiletest suite=run-make-fulldeps mode=run-make host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu

---- [run-make] run-make-fulldeps/compiler-lookup-paths stdout ----


error: make failed
status: exit status: 2
command: "make"
--- stdout -------------------------------
cc -ffunction-sections -fdata-sections -fPIC -m64 -c -o /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/libnative.o native.c
ar crus /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/libnative.a /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/libnative.o
mkdir -p /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/crate
mkdir -p /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/native
mv /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/libnative.a /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/native
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths  a.rs
mv /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/liba.rlib /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/crate
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths  b.rs -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/crate && exit 1 || exit 0
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths  b.rs -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/crate && exit 1 || exit 0
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths  b.rs -L crate=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/crate
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths  b.rs -L all=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/crate
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths  c.rs -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/crate && exit 1 || exit 0
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths  c.rs -L crate=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/crate && exit 1 || exit 0
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths  c.rs -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/crate
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths  c.rs -L all=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/crate
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths  d.rs -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/native && exit 1 || exit 0
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths  d.rs -L crate=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/native && exit 1 || exit 0
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths  d.rs -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/native
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths  d.rs -L all=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/native
# Deduplication tests:
#   Same hash, no errors.
mkdir -p /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/e1
mkdir -p /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/e2
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths  e.rs -o /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/e1/libe.rlib
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths  e.rs -o /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/e2/libe.rlib
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths  f.rs -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/e1 -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/e2
rm /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/libnative.o
--- stderr -------------------------------
ar: `u' modifier ignored since `D' is the default (see `U')
error[E0463]: can't find crate for `a`
 --> b.rs:2:1
---

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `a` which `b` depends on
 --> c.rs:2:1
2 | extern crate b;
  | ^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error
error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `a` which `b` depends on
 --> c.rs:2:1
2 | extern crate b;
  | ^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error
error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: could not find native static library `native`, perhaps an -L flag is missing?
error: aborting due to previous error


error: could not find native static library `native`, perhaps an -L flag is missing?
error: aborting due to previous error

warning: ignoring --out-dir flag due to -o flag


warning: 1 warning emitted

warning: ignoring --out-dir flag due to -o flag

warning: 1 warning emitted

error[E0465]: multiple rlib candidates for `e` found
 --> f.rs:2:1
2 | extern crate e;
  | ^^^^^^^^^^^^^^^
  |
  |
note: candidate #1: /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/e1/libe.rlib
 --> f.rs:2:1
2 | extern crate e;
  | ^^^^^^^^^^^^^^^
  | ^^^^^^^^^^^^^^^
note: candidate #2: /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/compiler-lookup-paths/compiler-lookup-paths/e2/libe.rlib
 --> f.rs:2:1
2 | extern crate e;
  | ^^^^^^^^^^^^^^^

error: aborting due to previous error
error: aborting due to previous error

make: *** [Makefile:27: all] Error 1


---- [run-make] run-make-fulldeps/extern-flag-fun stdout ----


error: make failed
status: exit status: 2
command: "make"
--- stdout -------------------------------
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun  bar.rs --crate-type=rlib
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun  bar.rs --crate-type=rlib -C extra-filename=-a
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun  bar-alt.rs --crate-type=rlib
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun  foo.rs --extern bar=no-exist && exit 1 || exit 0
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun  foo.rs --extern bar=foo.rs && exit 1 || exit 0
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun  foo.rs \
 --extern bar=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun/libbar.rlib \
 --extern bar=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun/libbar-alt.rlib \
 && exit 1 || exit 0
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun  foo.rs \
 --extern bar=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun/libbar.rlib \
 --extern bar=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun/libbar-a.rlib
--- stderr -------------------------------
--- stderr -------------------------------
error: extern location for bar does not exist: no-exist
  |
1 | extern crate bar;
  | ^^^^^^^^^^^^^^^^^

---
  |
1 | extern crate bar;
  | ^^^^^^^^^^^^^^^^^ can't find crate
  |
  = note: extern location for bar is of an unknown type: foo.rs
  = help: file name should be lib*.rlib or lib*..so
error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
For more information about this error, try `rustc --explain E0463`.
error: extern location for bar does not exist: /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun/libbar-alt.rlib
  |
1 | extern crate bar;
  | ^^^^^^^^^^^^^^^^^


error: aborting due to previous error

error[E0465]: multiple rlib candidates for `bar` found
  |
1 | extern crate bar;
  | ^^^^^^^^^^^^^^^^^
  |
  |
note: candidate #1: /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun/libbar.rlib
  |
1 | extern crate bar;
  | ^^^^^^^^^^^^^^^^^
  | ^^^^^^^^^^^^^^^^^
note: candidate #2: /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/extern-flag-fun/extern-flag-fun/libbar-a.rlib
  |
1 | extern crate bar;
  | ^^^^^^^^^^^^^^^^^


error: aborting due to previous error

make: *** [Makefile:10: all] Error 1



---- [run-make] run-make-fulldeps/issue-11908 stdout ----
error: make failed
status: exit status: 2
command: "make"
--- stdout -------------------------------
--- stdout -------------------------------
mkdir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/issue-11908/issue-11908/other
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/issue-11908/issue-11908:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/issue-11908/issue-11908 -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/issue-11908/issue-11908  foo.rs --crate-type=dylib -C prefer-dynamic
mv /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/issue-11908/issue-11908/libfoo.so /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/issue-11908/issue-11908/other
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/issue-11908/issue-11908:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/issue-11908/issue-11908 -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/issue-11908/issue-11908  foo.rs --crate-type=dylib -C prefer-dynamic
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/issue-11908/issue-11908:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/issue-11908/issue-11908 -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/issue-11908/issue-11908  bar.rs -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/issue-11908/issue-11908/other
--- stderr -------------------------------
--- stderr -------------------------------
error[E0465]: multiple dylib candidates for `foo` found
 --> bar.rs:1:1
1 | extern crate foo;
  | ^^^^^^^^^^^^^^^^^
  |
  |
note: candidate #1: /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/issue-11908/issue-11908/other/libfoo.so
 --> bar.rs:1:1
1 | extern crate foo;
  | ^^^^^^^^^^^^^^^^^
  | ^^^^^^^^^^^^^^^^^
note: candidate #2: /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/issue-11908/issue-11908/libfoo.so
 --> bar.rs:1:1
1 | extern crate foo;
  | ^^^^^^^^^^^^^^^^^

error: aborting due to previous error
error: aborting due to previous error

make: *** [Makefile:15: all] Error 1


---- [run-make] run-make-fulldeps/reproducible-build stdout ----


error: make failed
status: exit status: 2
command: "make"
--- stdout -------------------------------
rm -rf /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build && mkdir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build  linker.rs -O
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build  reproducible-build-aux.rs
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build  reproducible-build.rs -C linker=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build/linker
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build  reproducible-build.rs -C linker=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build/linker
diff -u "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build/linker-arguments1" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build/linker-arguments2"
rm -rf /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build && mkdir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build  linker.rs -O
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build  reproducible-build-aux.rs -g
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build  reproducible-build.rs -C linker=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build/linker -g
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build  reproducible-build.rs -C linker=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build/linker -g
diff -u "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build/linker-arguments1" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build/linker-arguments2"
rm -rf /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build && mkdir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build  linker.rs -O
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build  reproducible-build-aux.rs -O
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build  reproducible-build.rs -C linker=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build/linker -O
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build  reproducible-build.rs -C linker=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build/linker -O
diff -u "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build/linker-arguments1" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build/linker-arguments2"
rm -rf /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build && mkdir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build  reproducible-build-aux.rs
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build  reproducible-build.rs --crate-type rlib -L /b
cp /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build/libreproducible_build.rlib /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build/libfoo.rlib
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build  reproducible-build.rs --crate-type rlib -L /a
cmp "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build/libreproducible_build.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build/libfoo.rlib" || exit 1
/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build/libreproducible_build.rlib /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build/reproducible-build/libfoo.rlib differ: char 14575, line 48
--- stderr -------------------------------
--- stderr -------------------------------
make: *** [Makefile:55: link_paths] Error 1



---- [run-make] run-make-fulldeps/reproducible-build-2 stdout ----
error: make failed
status: exit status: 2
command: "make"
--- stdout -------------------------------
--- stdout -------------------------------
rm -rf /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2 && mkdir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2 -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2  reproducible-build-aux.rs
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2 -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2  reproducible-build.rs -C lto=fat
cp /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2/reproducible-build /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2/reproducible-build-a
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2 -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2  reproducible-build.rs -C lto=fat
cmp "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2/reproducible-build-a" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2/reproducible-build" || exit 1
rm -rf /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2 && mkdir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2 -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2  reproducible-build-aux.rs
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2 -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2  reproducible-build.rs --crate-type rlib --sysroot /checkout/obj/build/x86_64-unknown-linux-gnu/stage2 --remap-path-prefix=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2=/sysroot
cp -R /checkout/obj/build/x86_64-unknown-linux-gnu/stage2 /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2/sysroot
cp /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2/libreproducible_build.rlib /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2/libfoo.rlib
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2 -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2  reproducible-build.rs --crate-type rlib --sysroot /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2/sysroot --remap-path-prefix=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2/sysroot=/sysroot
cmp "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2/libreproducible_build.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2/libfoo.rlib" || exit 1
/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2/libreproducible_build.rlib /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/reproducible-build-2/reproducible-build-2/libfoo.rlib differ: char 14577, line 48
--- stderr -------------------------------
--- stderr -------------------------------
make: *** [Makefile:26: sysroot] Error 1



failures:

@bjorn3
Copy link
Member

bjorn3 commented Mar 11, 2022

This would make builds non-reproducible and if anything increase the risk of multiple crates having the same crate hash due to being either built very close to each other on the same machine, multiple machines having the same time or the time going backwards due to eg an empty cmos battery or ntp adjustments.

@bors
Copy link
Contributor

bors commented Mar 11, 2022

☀️ Try build successful - checks-actions
Build commit: 9fc5ba51a036e587a8b4be991f470bd2d268a87b (9fc5ba51a036e587a8b4be991f470bd2d268a87b)

@rust-timer
Copy link
Collaborator

Queued 9fc5ba51a036e587a8b4be991f470bd2d268a87b with parent af8604f, future comparison URL.

@michaelwoerister
Copy link
Member Author

Sure, this is just an experiment to see the maximum impact something like this can have on incr comp performance. Reproducible builds are high priority. An actual implementation would have to take that into account.

I'm starting to wonder though if we need the crate hash in the current form at all.

@bjorn3
Copy link
Member

bjorn3 commented Mar 11, 2022

I'm starting to wonder though if we need the crate hash in the current form at all.

The crate hash is what ensures that replacing a dependency always forces the dependent crate to be recompiled. (Something more finegrained may make it impossible to eg add extra query dependencies without causing breakage) It is also essential for incr comp to invalidate queries based on changed crate metadata.

@cjgillot
Copy link
Contributor

I am not sure this perf run will measure what we want it to measure.
In my understanding, one of the main roles of crate hash is to tell the query system whether we should load a value from metadata. This is useful to skip loading values from upstream crates that are known to be green. Changing to a timestamp will not change the behaviour: the perf infra does not rebuild upstream crates, so their crate hash won't change between to builds, and we will only measure the cost of computing the hash.
If we want to measure the effect of always loading data, we had better mark crate hash query as no_hash. This will prevent the query system from using its value to mark stuff green, and force loading the data from disk.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (9fc5ba51a036e587a8b4be991f470bd2d268a87b): comparison url.

Summary: This benchmark run shows 44 relevant improvements 🎉 but 77 relevant regressions 😿 to instruction counts.

  • Arithmetic mean of relevant regressions: 1.5%
  • Arithmetic mean of relevant improvements: -0.5%
  • Arithmetic mean of all relevant changes: 0.8%
  • Largest improvement in instruction counts: -1.5% on full builds of unused-warnings check
  • Largest regression in instruction counts: 8.7% on incr-unchanged builds of stm32f4 check

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR led to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf +perf-regression

@rustbot rustbot added perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Mar 11, 2022
@@ -776,7 +776,6 @@ impl<T> MaybeOwner<T> {
#[derive(Debug)]
pub struct Crate<'hir> {
pub owners: IndexVec<LocalDefId, MaybeOwner<&'hir OwnerInfo<'hir>>>,
pub hir_hash: Fingerprint,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? This may force re-executions that are unrelated to crate_hash.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's true, making the hir_crate query no_hash is an unrelated change. Although from the performance results it looks like it does not make much of difference?

@michaelwoerister
Copy link
Member Author

Let me try to elaborate where this might be going. Some background first: With respect to incremental compilation, the crate hash is used to determine if something from crate metadata can have changed at all. I.e. it is the root dependency node for all queries that read from the metadata of a given upstream crate. The requirement for it is thus that if anything in crate metadata changes, it too needs to reflect that change.

Right now crate hash is computed from a set of things that supposedly makes it fulfill this requirement: the HIR, (some) commandline args, the file names of the current crate's source files after remapping, etc. There are some problems with this approach though:

  • We manually put together the list of everything that goes into this hash. This is error-prone as it is hard to tell what should go into it and what shouldn't. @cjgillot recently found a case where we miss changes to upstream source files, for example. Commandline arguments are another example, where each argument has to be tagged and it is easy to miss something.
  • Among other things we construct the crate hash from the HIR, which already has made querifying HIR-related things more complicated. Not catastrophically so, but it is one more thing that has to be taken into account when working in this area. The situation has improved quite a bit since @cjgillot's recent refactorings there, I think, but in the past the attempt to avoid hashing things twice has been a major source of bugs and hard-to-understand code.
  • IIUC, right now, in non-incremental mode, we are hashing the entire HIR just for the crate hash. I suspect that this has a small but measurable impact on compile times.

So, what I'm trying to figure out is: Can we make this cheaper, simpler, and more robust at the same time.

I see several options:

  1. Remove the crate hash entirely and just make the root dep-node for crate metadata no_hash as @cjgillot says above.
  • Pro: we can remove a bunch of complicated and costly computations entirely. Nothing can go wrong from a correctness standpoint.
  • Con: we force the compiler to re-fingerprint everything coming from crate metadata, even if there is no change at all, which is a rather common case.
  1. Compute the crate hash by simply hashing the bytes of crate metadata.
  • Pro: It is much simpler than the current approach. No other part of compiler has to know about it.
  • Pro: We cannot miss any data from the current crate, even if arbitrary new stuff gets added to the compiler. We don't need to try and come up with an exhaustive list of things that we think can have an influence.
  • Pro: It's probably cheaper computationally because bulk-hashing flat byte streams is something that computers are really good at. This would be even more true if we switched to something like UMASH fingerprints or XXH3 for hashing -- but that wouldn't be a necessary prerequisite, I suspect.
  • Con: It might be slightly more sensitive to changes that don't make a semantic difference. However, the current implementation already is very sensitive and the most important use case, where Cargo doesn't even touch the upstream crate would be just the same as it is now.
  • Con: I'm not a 100% certain if we also need to include the crate hashes of upstream crates in order to catch all possible cases (like we do now). But worst case we just do that.
  1. We compute the crate hash by hashing source file contents instead of HIR. This would allow us to decouple the crate hash from the HIR, which can only be good.
  • Pro: Much simpler than hashing the HIR, especially on the implementation side. Makes HIR related refactorings easier.
  • Con: Sensitive to semantically irrelevant changes.
  • Con: We have to account for the results of macro expansion too somehow. This might be as simple as including the crate hash of proc-macro crates -- but that would assume that proc-macros are deterministic which in general they are not required to be.
  • Con: We still have to feed all the other things like command-line arguments into the hash. So this approach inherits most of the robustness problems of the current approach.

I think that option (2) is by far the most promising. Option (1) is a distant second because of the performance implications. Option (3) might be even worse than the current approach due to the macro problem.

Consider yourselves invited to try and poke holes in my reasoning :)

@cjgillot
Copy link
Contributor

I agree with your reasoning.

I see several options:

1. Remove the crate hash entirely and just make the root dep-node for crate metadata `no_hash` as @cjgillot says above.


* Pro: we can remove a bunch of complicated and costly computations entirely. Nothing can go wrong from a correctness standpoint.

* Con: we force the compiler to re-fingerprint everything coming from crate metadata, even if there is no change at all, which is a rather common case.

Remark: we already partially re-fingerprint data we are loading from disk even when the crate_hash is green, as part of the "unstable fingerprint" check.

2. Compute the crate hash by simply hashing the bytes of crate metadata.


* Pro: It is much simpler than the current approach. No other part of compiler has to know about it.

* Pro: We cannot miss any data from the current crate, even if arbitrary new stuff gets added to the compiler. We don't need to try and come up with an exhaustive list of things that we think can have an influence.

* Pro: It's probably cheaper computationally because bulk-hashing flat byte streams is something that computers are really good at. This would be even more true if we switched to something like UMASH fingerprints or XXH3 for hashing -- but that wouldn't be a necessary prerequisite, I suspect.

* Con: It might be slightly more sensitive to changes that don't make a semantic difference. However, the current implementation already is very sensitive and the most important use case, where Cargo doesn't even touch the upstream crate would be just the same as it is now.

* Con: I'm not a 100% certain if we also need to include the crate hashes of upstream crates in order to catch all possible cases (like we do now). But worst case we just do that.

I just posted #94878 as a call for participation to investigate this. I am available to mentor it, you are welcome to join.

"Con 1" may just be the necessary cost for our peace of mind here. We will have to measure the perf effect of course.
"Con 2" do we need to include the upstream crate hash? If we hash exactly what goes into metadata, we may not need to.

One tricky thing will be to have the stable hasher and the metadata encoding agree:

  • metadata encoder will see a DefId as a pair of integers, while the stable hasher will see it as a DefPathHash;
  • metadata encoder is order-sensitive, while the stable hasher ignores the order of DefIds.
3. We compute the crate hash by hashing source file contents instead of HIR. This would allow us to decouple the crate hash from the HIR, which can only be good.


* Pro: Much simpler than hashing the HIR, especially on the implementation side. Makes HIR related refactorings easier.

* Con: Sensitive to semantically irrelevant changes.

* Con: We have to account for the results of macro expansion too somehow. This might be as simple as including the crate hash of proc-macro crates -- but that would assume that proc-macros are deterministic which in general they are not required to be.

* Con: We still have to feed all the other things like command-line arguments into the hash. So this approach inherits most of the robustness problems of the current approach.

In general, proc macros are not deterministic, they could even emit a time stamp. Only regular macros are. In consequence, we need to hash the post-expansion AST, or to add the output of each proc-macro expansion to the crate hash.

I think that option (2) is by far the most promising. Option (1) is a distant second because of the performance implications. Option (3) might be even worse than the current approach due to the macro problem.

Consider yourselves invited to try and poke holes in my reasoning :)

I agree with the ordering of solutions, and I haven't found holes yet :).

@bjorn3
Copy link
Member

bjorn3 commented Mar 12, 2022

Con: I'm not a 100% certain if we also need to include the crate hashes of upstream crates in order to catch all possible cases (like we do now). But worst case we just do that.

Yes we do. In any case the crate metadata already contains the crate hash for all dependencies so hashing the crate metadata is enough.

Note that hashing the crate metadata is not enough for proc macros. The crate metadata can be unchanged despite the actual implementation changing. If the implementation changes the crate hash needs to change to ensure that we don't forget to expand the proc macro invocations again.

@michaelwoerister
Copy link
Member Author

metadata encoder will see a DefId as a pair of integers, while the stable hasher will see it as a DefPathHash;

That's the main uncertainty I see with this approach, yes. It might be OK to hash the bytes verbatim because the tables needed for decoding the indices are part of the same value - but I'm not certain that that covers everything. The approach in #94878 should not have that issue though.

@cjgillot
Copy link
Contributor

As a first step, we could reuse what @Aaron1011 did in #87896 (= just sha256 the binary blob), and refine from there if the perf effect is too large.

@michaelwoerister
Copy link
Member Author

Hashing the binary blob is what I suggested above. However, it does potentially have the problem you mentioned.

But if we also feed the crate hashes of all upstream crates into the hash, we will have transitively hashed all the data that can be used to do the defid->defpathhash mapping and thus should be able to detect any relevant change.

I haven't had time to really think through this though - so take it with a grain of salt :)

@michaelwoerister
Copy link
Member Author

Con: I'm not a 100% certain if we also need to include the crate hashes of upstream crates in order to catch all possible cases (like we do now). But worst case we just do that.

Yes we do.

@bjorn3, can you elaborate your reasoning here? I don't disagree but I'd be interested in why you think it's necessary.

In any case the crate metadata already contains the crate hash for all dependencies so hashing the crate metadata is enough.

Ah yes, that's true.

Note that hashing the crate metadata is not enough for proc macros. The crate metadata can be unchanged despite the actual implementation changing. If the implementation changes the crate hash needs to change to ensure that we don't forget to expand the proc macro invocations again.

I assume you are referring to "This might be as simple as including the crate hash of proc-macro crates" in Option (3), right?

@bjorn3
Copy link
Member

bjorn3 commented Mar 15, 2022

@bjorn3, can you elaborate your reasoning here? I don't disagree but I'd be interested in why you think it's necessary.

Upstream crates can affect things like the layout of used types. Layouts are not stored in the crate metadata and thus wouldn't change the crate hash unless dependencies are included in the crate hash.

@bjorn3
Copy link
Member

bjorn3 commented Mar 15, 2022

I assume you are referring to "This might be as simple as including the crate hash of proc-macro crates" in Option (3), right?

I was refering to option 2. Hashing just the crate metadata would not contain enough data to uniquely identify proc macros when their implementation changes, which may cause proc macros to not be re-expanded on implementation changes if macro expansion becomes incremental.

@michaelwoerister
Copy link
Member Author

I've been thinking a bit more about this. IMO, the only reason why hashing the crate metadata as a flat byte stream is not trivially correct is that the CrateLoader does some additional processing (like computing the cnum_map) which might introduce data dependencies on things that come from outside the byte stream. The way things are set up right now, it is very hard to tell what data goes into computing this additional data structures.

If things were set up in a way that there was an eval_always query that only allowed access to the MetadataBlob then things would be simpler.

I think what @cjgillot proposes in #94878 would be an improvement over what we have currently. I'd be very interested in seeing how it performs.

I'm going to close this PR as it's clear that we won't merge it.

@michaelwoerister
Copy link
Member Author

@bjorn3, can you elaborate your reasoning here? I don't disagree but I'd be interested in why you think it's necessary.

Upstream crates can affect things like the layout of used types. Layouts are not stored in the crate metadata and thus wouldn't change the crate hash unless dependencies are included in the crate hash.

Wouldn't you necessarily also introduce a dependency on the crate hash of the upstream crate in such cases?

@michaelwoerister
Copy link
Member Author

I assume you are referring to "This might be as simple as including the crate hash of proc-macro crates" in Option (3), right?

I was refering to option 2. Hashing just the crate metadata would not contain enough data to uniquely identify proc macros when their implementation changes, which may cause proc macros to not be re-expanded on implementation changes if macro expansion becomes incremental.

So this would be in the case where the upstream crate is a proc-macro?

@bjorn3
Copy link
Member

bjorn3 commented Mar 15, 2022

At the query graph level yes, all data loaded from dependencies results in a dependency on the crate_hash query. At the crate metadata level, the explicit list of the dependency in the crate metadata is the only thing ensuring that dependency versions aren't mismatched. This list needs to be part of the crate hash one way or another. Hashing just file sources would not be enough for this. Hashing full crate metadata would be enough.

@michaelwoerister
Copy link
Member Author

Right, proc-macro crates don't seem to encode their MIR at the moment -- so I can see how this is a problem.

@michaelwoerister
Copy link
Member Author

Hm, given that proc-macros are not required to be deterministic, they would need to be handled specially anyway, I guess. I.e. even a hash that completely captured the code of the proc macro would not be strictly correct since the proc-macro can still pull in data from arbitrary sources. So we would have to unconditionally assume that it has changed.

@bjorn3
Copy link
Member

bjorn3 commented Mar 15, 2022

For something like rust-analyzer unconditionally assuming that proc macro output has changed would result in 100% cpu usage if any proc macro is used. It should re-expand exactly when the proc macro needs to be/has been recompiled. In the future when rust-analyzer and rustc share more code it would be nice to be able to use the crate hash for that purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants