rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97.01k stars 12.54k forks source link

Error when running `ui` tests after `run-make-fulldeps` #92644

Open pietroalbini opened 2 years ago

pietroalbini commented 2 years ago

While running the test suite I noticed that executing the run-make-fulldeps suite before the ui suite causes the following tests to fail:

error[E0464]: multiple matching crates for `libc`
  --> /.../src/test/ui/allocator/no_std-alloc-error-handler-default.rs:16:1
   |
LL | extern crate libc;
   | ^^^^^^^^^^^^^^^^^^
   |
   = note: candidates:
           crate `libc`: /.../build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-2383dbda905dd8ee.rlib
           crate `libc`: /.../build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-a96bf8e49971bcfd.rlib

error: aborting due to previous error

For more information about this error, try `rustc --explain E0464`.

After a quick investigation it seems like building rustc-demangler puts an extra copy of liblibc-HASH.rlib (with a different hash) in the stage2 libs directory, causing the UI test not to know which libc to link to.

Reproduction

Running this command (just the ui test before run-make-fulldeps) works:

./x.py --stage 2 test src/test/ui/allocator/no_std-alloc-error-handler-default.rs src/test/run-make-fulldeps

Running this command (run-make-fulldeps before the ui test) fails:

./x.py --stage 2 src/test/run-make-fulldeps test src/test/ui/allocator/no_std-alloc-error-handler-default.rs
jyn514 commented 1 year ago

I am unclear: how did you get bootstrap to run the fulldeps test first? it should be run in a fixed order regardless of the order of the CLI arguments: https://github.com/rust-lang/rust/pull/110229#issuecomment-1510272290