Skip to content

mut_mut_macro test fails after 'cargo check': "multiple matching crates for lazy_static" #2139

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

Closed
ykrivopalov opened this issue Oct 15, 2017 · 3 comments
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@ykrivopalov
Copy link

I have a problem with tests execution. Every time, when I do cargo check, subsequent launch of cargo test fails.

It reproduces like this:

cargo clean
cargo test # SUCCEED
cargo test # SUCCEED
cargo check
cargo test # FAILED

It worked in such a way for me with different releases.

My current environment:

$ rustup show
Default host: x86_64-unknown-linux-gnu

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.22.0-nightly (02a24dbdd 2017-10-13)

Failed test:

failures:

---- [run-pass] run-pass/mut_mut_macro.rs stdout ----

error: compilation failed!
status: exit code: 101
command: target/debug/clippy-driver tests/run-pass/mut_mut_macro.rs -L target/debug/test_build_base --target=x86_64-unknown-linux-gnu --error-format json -L target/debug/test_build_base/mut_mut_macro.stage-id.run-pass.libaux -C prefer-dynamic -o target/debug/test_build_base/mut_mut_macro.stage-id -L target/debug/ -L target/debug/deps -Dwarnings
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
{"message":"multiple matching crates for `lazy_static`","code":{"code":"E0464","explanation":null},"level":"error","spans":[{"file_name":"tests/run-pass/mut_mut_macro.rs","byte_start":74,"byte_end":99,"line_start":7,"line_end":7,"column_start":1,"column_end":26,"is_primary":true,"text":[{"text":"extern crate lazy_static;","highlight_start":1,"highlight_end":26}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[{"message":"candidates:","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"path: /home/yk/dev/rust-clippy/target/debug/deps/liblazy_static-e94bdb055ffaade6.rlib","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"crate name: lazy_static","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"crate name: lazy_static","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":null}
{"message":"can't find crate for `lazy_static`","code":{"code":"E0463","explanation":"\nA plugin/crate was declared but cannot be found. Erroneous code example:\n\n```compile_fail,E0463\n#![feature(plugin)]\n#![plugin(cookie_monster)] // error: can't find crate for `cookie_monster`\nextern crate cake_is_a_lie; // error: can't find crate for `cake_is_a_lie`\n```\n\nYou need to link your code to the relevant crate in order to be able to use it\n(through Cargo or the `-L` option of rustc example). Plugins are crates as\nwell, and you link to them the same way.\n"},"level":"error","spans":[{"file_name":"tests/run-pass/mut_mut_macro.rs","byte_start":74,"byte_end":99,"line_start":7,"line_end":7,"column_start":1,"column_end":26,"is_primary":true,"text":[{"text":"extern crate lazy_static;","highlight_start":1,"highlight_end":26}],"label":"can't find crate","suggested_replacement":null,"expansion":null}],"children":[],"rendered":null}
{"message":"aborting due to 2 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":null}
thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:525:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.
thread 'main' panicked at 'rustc_thread failed: Any', /checkout/src/libcore/result.rs:906:4

------------------------------------------

thread '[run-pass] run-pass/mut_mut_macro.rs' panicked at 'explicit panic', /home/yk/.cargo/registry/src/github.com-1ecc6299db9ec823/compiletest_rs-0.2.10/src/runtest.rs:2374:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Full test log: https://hastebin.com/etekarumis

I don't understand why it happend. Does it reproduce for anybody else?

@oli-obk
Copy link
Contributor

oli-obk commented Oct 16, 2017

This is an issue with compiletest-rs. You need to do cargo clean when that happens.

EDIT: nevermind, you did that...

Uhm... No idea what cargo check does, but apparently it produces additional crates.

@oli-obk oli-obk added the C-bug Category: Clippy is not doing the correct thing label Oct 16, 2017
@phansch
Copy link
Member

phansch commented Nov 23, 2017

I ran into the same problem yesterday. For me it seems to be caused by running rls in the background through vim. When I disable it, everything works. I will try to find out a bit more later today.

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.23.0-nightly (45594d5de 2017-11-22)

@oli-obk
Copy link
Contributor

oli-obk commented Nov 23, 2017

Ugh, compiletest is such a mess. We should probably be including extern libraries explicitly like cargo does. I wonder if we can reuse some logic from cargo.

matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this issue Oct 29, 2018
bors bot added a commit that referenced this issue Oct 29, 2018
3380: compiletest: clean rmeta data (from "cargo check") before running compiletest r=phansch a=matthiaskrgr

Fixes #2896
Fixes #2139

Co-authored-by: Matthias Krüger <[email protected]>
@bors bors bot closed this as completed in #3380 Oct 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

No branches or pull requests

3 participants