From d4c9fe7549f29ca573f5a58ac94eacd662cd1421 Mon Sep 17 00:00:00 2001 From: Igor Aleksanov Date: Sun, 20 Jun 2021 08:25:30 +0300 Subject: [PATCH 1/3] Improve visibility&helpfulness of the 'found multiple rlibs' error --- tests/compile-test.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/compile-test.rs b/tests/compile-test.rs index 7d266a36b..72905bd94 100644 --- a/tests/compile-test.rs +++ b/tests/compile-test.rs @@ -48,7 +48,13 @@ fn third_party_crates() -> String { && name.rsplit('.').next().map(|ext| ext.eq_ignore_ascii_case("rlib")) == Some(true) { if let Some(old) = crates.insert(dep, path.clone()) { - panic!("Found multiple rlibs for crate `{}`: `{:?}` and `{:?}", dep, old, path); + panic!( + "\n---------------------------------------------------\n\n \ + Found multiple rlibs for crate `{}`: `{:?}` and `{:?}`.\n \ + Probably, you need to run `cargo clean` before running tests again.\n \ + \n---------------------------------------------------\n", + dep, old, path + ); } break; } From faa2fa7490423b30362b44034e9336c469556b6b Mon Sep 17 00:00:00 2001 From: Igor Aleksanov Date: Sun, 20 Jun 2021 08:32:43 +0300 Subject: [PATCH 2/3] Improve appearance --- tests/compile-test.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/compile-test.rs b/tests/compile-test.rs index 72905bd94..8640cfb96 100644 --- a/tests/compile-test.rs +++ b/tests/compile-test.rs @@ -52,6 +52,7 @@ fn third_party_crates() -> String { "\n---------------------------------------------------\n\n \ Found multiple rlibs for crate `{}`: `{:?}` and `{:?}`.\n \ Probably, you need to run `cargo clean` before running tests again.\n \ + \nFor details on that error see https://github.com/rust-lang/rust-clippy/issues/7343 \ \n---------------------------------------------------\n", dep, old, path ); From 310a2043066212e4bc702d2a79dc50a1312ac94d Mon Sep 17 00:00:00 2001 From: Igor Aleksanov Date: Mon, 21 Jun 2021 06:57:57 +0300 Subject: [PATCH 3/3] Provide different message for bootstrapped compiler --- tests/compile-test.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/compile-test.rs b/tests/compile-test.rs index 8640cfb96..caa19e39c 100644 --- a/tests/compile-test.rs +++ b/tests/compile-test.rs @@ -48,13 +48,23 @@ fn third_party_crates() -> String { && name.rsplit('.').next().map(|ext| ext.eq_ignore_ascii_case("rlib")) == Some(true) { if let Some(old) = crates.insert(dep, path.clone()) { + // Check which action should be done in order to remove compiled deps. + // If pre-installed version of compiler is used, `cargo clean` will do. + // Otherwise (for bootstrapped compiler), the dependencies directory + // must be removed manually. + let suggested_action = if std::env::var_os("RUSTC_BOOTSTRAP").is_some() { + "remove the stageN-tools directory" + } else { + "run `cargo clean`" + }; + panic!( "\n---------------------------------------------------\n\n \ Found multiple rlibs for crate `{}`: `{:?}` and `{:?}`.\n \ - Probably, you need to run `cargo clean` before running tests again.\n \ + Probably, you need to {} before running tests again.\n \ \nFor details on that error see https://github.com/rust-lang/rust-clippy/issues/7343 \ \n---------------------------------------------------\n", - dep, old, path + dep, old, path, suggested_action ); } break;