rust-lang / rust-lang/rust

Miri dep-tests sometimes fail to find crate

Open
#149,711 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug E-needs-investigation T-bootstrap
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I am not yet sure how to reproduce this, but while working on a combined rustc/Miri change I am now in a state where I cannot run any of the "dep" tests (e.g. via ./x test miri -- env). They all just error with:

error[E0460]: found possibly newer version of crate `core` which `lib` depends on
  --> tests/pass-dep/concurrency/env-cleanup-data-race.rs:LL:CC
   |
LL |             let s = libc::getenv("MIRI_ENV_VAR_TEST/0".as_ptr().cast());
   |                     ^^^^
   |
   = note: perhaps that crate needs to be recompiled?
   = note: the following crate versions were found:
           crate `core`: /home/r/src/rust/rustc/build/x86_64-unknown-linux-gnu/miri-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-46e04d29f5fdda95.rmeta
           crate `core`: /home/r/src/rust/rustc/build/x86_64-unknown-linux-gnu/miri-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-46e04d29f5fdda95.rlib
           crate `lib`: /home/r/src/rust/rustc/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-9c09f79981fe2cb3.rlib
           crate `lib`: /home/r/src/rust/rustc/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-9c09f79981fe2cb3.rmeta

error: aborting due to 1 previous error

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

I tried deleting both of the directories mentioned there (miri-sysroot and deps) so they get rebuilt in a clean way, and I also deleted ./build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/tmp/miri_ui (where the Miri test suite builds its dependencies), but so far nothing helped. OTOH I also was not able to reproduce this in another checkout. Maybe there is some other old state left behind in the affected checkout, but I wouldn't know where that state could be or why it doesn't get automatically cleared.

Strangely, it seems like dependencies also get rebuilt each time. @oli-obk the ui-test output is not very clear here:

FAILED TEST: tests/pass-dep/libc/libc-env.rs
command: env -u RUSTFLAGS "/home/r/src/rust/rustc/build/x86_64-unknown-linux-gnu/stage1/bin/cargo-miri" "miri" "run" "--target-dir" "/home/r/src/rust/rustc/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/tmp/miri_ui/0" "--manifest-path" "tests/deps/Cargo.toml" "--target=x86_64-unknown-linux-gnu" "--message-format=json"


FAILED TEST: tests/pass-dep/concurrency/env-cleanup-data-race.rs
command: Building dependencies

FAILURES:
    tests/pass-dep/libc/libc-env.rs
    tests/pass-dep/concurrency/env-cleanup-data-race.rs

test result: FAIL. 2 failed; 50 filtered out

Error: 
   0: ui tests in tests/pass-dep for x86_64-unknown-linux-gnu failed
   1: tests failed

Location:
   /home/r/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ui_test-0.30.3/src/lib.rs:365

The error above is from the stderr file that gets created when I also add --bless.

Cc @bjorn3 -- I saw https://github.com/rust-lang/rust/pull/149273; not sure if that is related. I didn't get such errors in the past so I wonder if something changed in the last few weeks/months that broke this.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ./x test miri -- env command and the failing tests under tests/pass-dep, especially libc/libc-env.rs and concurrency/env-cleanup-data-race.rs; inspect tests/deps/Cargo.toml and the ui_test invocation shown in the report. Determine why incompatible core artifacts are selected or dependencies rebuild repeatedly, then make the dep tests pass reliably without E0460.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.