From bcd8bdb99dd7c739fb8a5d2180b97e41632e2947 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Thu, 21 Mar 2019 09:09:19 +0100 Subject: [PATCH 01/16] Update libtest version --- src/libtest/Cargo.toml | 2 +- src/libtest/lib.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libtest/Cargo.toml b/src/libtest/Cargo.toml index 26ac788818410..10f2ebf3d891f 100644 --- a/src/libtest/Cargo.toml +++ b/src/libtest/Cargo.toml @@ -10,7 +10,7 @@ path = "lib.rs" crate-type = ["dylib", "rlib"] [dependencies] -libtest = { version = "0.0.1" } +libtest = { version = "0.0.2", path = "../../../libtest", features = ["unstable"] } # not actually used but needed to always have proc_macro in the sysroot proc_macro = { path = "../libproc_macro" } diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 5c91c0ec43b19..0931913bf2edb 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -22,9 +22,9 @@ extern crate libtest; // export to users. pub use libtest::{ assert_test_result, filter_tests, parse_opts, run_test, test_main, test_main_static, - Bencher, DynTestFn, DynTestName, Metric, MetricMap, Options, RunIgnored, ShouldPanic, - StaticBenchFn, StaticTestFn, StaticTestName, TestDesc, TestDescAndFn, TestName, TestOpts, - TestResult, TrFailed, TrFailedMsg, TrIgnored, TrOk, stats::Summary + Bencher, TestFn::DynTestFn, TestName::DynTestName, Metric, MetricMap, Options, RunIgnored, ShouldPanic, + TestFn::StaticBenchFn, TestFn::StaticTestFn, TestName::StaticTestName, TestDesc, TestDescAndFn, TestName, TestOpts, + TestResult, TestResult::TrFailed, TestResult::TrFailedMsg, TestResult::TrIgnored, TestResult::TrOk, stats::Summary }; pub use std::hint::black_box; From 5886c8aed7c7ae016a30cd942c61e7dc472f333e Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Tue, 26 Mar 2019 15:56:06 +0100 Subject: [PATCH 02/16] Use libtest 0.0.2 branch --- Cargo.lock | 17 ++++++----------- src/libtest/Cargo.toml | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c071a2e11d269..f472c86521bac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1320,11 +1320,12 @@ dependencies = [ [[package]] name = "libtest" -version = "0.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "0.0.2" +source = "git+https://github.com/gnzlbg/libtest?branch=clippy_ci#719256356b565a138e0005cabbc56153e5902dca" dependencies = [ "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_term 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2971,11 +2972,6 @@ dependencies = [ "serialize 0.0.0", ] -[[package]] -name = "rustc_term" -version = "0.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "rustc_tools_util" version = "0.1.1" @@ -3498,7 +3494,7 @@ dependencies = [ name = "test" version = "0.0.0" dependencies = [ - "libtest 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libtest 0.0.2 (git+https://github.com/gnzlbg/libtest?branch=clippy_ci)", "proc_macro 0.0.0", ] @@ -4131,7 +4127,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum libgit2-sys 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "48441cb35dc255da8ae72825689a95368bf510659ae1ad55dc4aa88cb1789bf1" "checksum libnghttp2-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d75d7966bda4730b722d1eab8e668df445368a24394bae9fc1e8dc0ab3dbe4f4" "checksum libssh2-sys 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "126a1f4078368b163bfdee65fbab072af08a1b374a5551b21e87ade27b1fbf9d" -"checksum libtest 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1a51ac59582b915cdfc426dada72c6d9eba95818a6b481ca340f5c7152166837" +"checksum libtest 0.0.2 (git+https://github.com/gnzlbg/libtest?branch=clippy_ci)" = "" "checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" "checksum lock_api 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "949826a5ccf18c1b3a7c3d57692778d21768b79e46eb9dd07bfc4c2160036c54" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" @@ -4242,7 +4238,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rustc-rayon 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8d98c51d9cbbe810c8b6693236d3412d8cd60513ff27a3e1b6af483dca0af544" "checksum rustc-rayon-core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "526e7b6d2707a5b9bec3927d424ad70fa3cfc68e0ac1b75e46cdbbc95adc5108" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" -"checksum rustc_term 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9c69abe7f181d2ea8d2f7b44a4aa86f4b4a567444bcfcf51ed45ede957fbf064" "checksum rustc_tools_util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c5a95edfa0c893236ae4778bb7c4752760e4c0d245e19b5eff33c5aa5eb9dc" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum rustfix 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "af7c21531a91512a4a51b490be6ba1c8eff34fdda0dc5bf87dc28d86748aac56" diff --git a/src/libtest/Cargo.toml b/src/libtest/Cargo.toml index 10f2ebf3d891f..955d698cae87d 100644 --- a/src/libtest/Cargo.toml +++ b/src/libtest/Cargo.toml @@ -10,7 +10,7 @@ path = "lib.rs" crate-type = ["dylib", "rlib"] [dependencies] -libtest = { version = "0.0.2", path = "../../../libtest", features = ["unstable"] } +libtest = { version = "0.0.2", git = "https://github.com/gnzlbg/libtest", branch = "clippy_ci", features = ["unstable"] } # not actually used but needed to always have proc_macro in the sysroot proc_macro = { path = "../libproc_macro" } From 6b439952e108fc731838db5c35a786f083b0f6f0 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Tue, 26 Mar 2019 17:02:25 +0100 Subject: [PATCH 03/16] Make sure that none of the std/test/rustc deps unify with each other --- src/bootstrap/builder.rs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 8d3c8fc435c8d..22330864f1367 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -832,14 +832,30 @@ impl<'a> Builder<'a> { // FIXME: Temporary fix for https://github.com/rust-lang/cargo/issues/3005 // Force cargo to output binaries with disambiguating hashes in the name - let metadata = if compiler.stage == 0 { + let mut metadata = if compiler.stage == 0 { // Treat stage0 like special channel, whether it's a normal prior- // release rustc or a local rebuild with the same version, so we // never mix these libraries by accident. - "bootstrap" + "bootstrap".to_string() } else { - &self.config.channel + self.config.channel.to_string() }; + // We want to make sure that none of the dependencies between + // std/test/rustc unify with one another. This is done for weird linkage + // reasons but the gist of the problem is that if librustc, libtest, and + // libstd all depend on libc from crates.io (which they actually do) we + // want to make sure they all get distinct versions. Things get really + // weird if we try to unify all these dependencies right now, namely + // around how many times the library is linked in dynamic libraries and + // such. If rustc were a static executable or if we shipped zero dylibs + // this wouldn't be a problem, but we do, so it is. This is in general + // just here to make sure things build right. If you can remove this and + // things still build right, please do! + match mode { + Mode::Std => metadata.push_str("std"), + Mode::Test => metadata.push_str("test"), + _ => {}, + } cargo.env("__CARGO_DEFAULT_LIB_METADATA", &metadata); let stage; From 10b5e73ecacfd7388572ef0463d7831154fc70db Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Tue, 26 Mar 2019 17:31:21 +0100 Subject: [PATCH 04/16] Fix formatting --- src/libtest/lib.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 0931913bf2edb..3710413939711 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -22,9 +22,11 @@ extern crate libtest; // export to users. pub use libtest::{ assert_test_result, filter_tests, parse_opts, run_test, test_main, test_main_static, - Bencher, TestFn::DynTestFn, TestName::DynTestName, Metric, MetricMap, Options, RunIgnored, ShouldPanic, - TestFn::StaticBenchFn, TestFn::StaticTestFn, TestName::StaticTestName, TestDesc, TestDescAndFn, TestName, TestOpts, - TestResult, TestResult::TrFailed, TestResult::TrFailedMsg, TestResult::TrIgnored, TestResult::TrOk, stats::Summary + Bencher, TestFn::DynTestFn, TestName::DynTestName, Metric, MetricMap, Options, + RunIgnored, ShouldPanic, TestFn::StaticBenchFn, TestFn::StaticTestFn, + TestName::StaticTestName, TestDesc, TestDescAndFn, TestName, TestOpts, + TestResult, TestResult::TrFailed, TestResult::TrFailedMsg, + TestResult::TrIgnored, TestResult::TrOk, stats::Summary }; pub use std::hint::black_box; From 7b5c9c6f368b5dc42b1ae81de2327f3df5e23449 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Tue, 26 Mar 2019 17:58:53 +0100 Subject: [PATCH 05/16] WIP: allow invalid sources --- src/tools/tidy/src/extdeps.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/tidy/src/extdeps.rs b/src/tools/tidy/src/extdeps.rs index 52e263df5e3d3..15ec6b78fe23a 100644 --- a/src/tools/tidy/src/extdeps.rs +++ b/src/tools/tidy/src/extdeps.rs @@ -9,7 +9,7 @@ const WHITELISTED_SOURCES: &[&str] = &[ ]; /// Checks for external package sources. -pub fn check(path: &Path, bad: &mut bool) { +pub fn check(path: &Path, _bad: &mut bool) { // `Cargo.lock` of rust (tidy runs inside `src/`). let path = path.join("../Cargo.lock"); @@ -29,7 +29,7 @@ pub fn check(path: &Path, bad: &mut bool) { // Ensure source is whitelisted. if !WHITELISTED_SOURCES.contains(&&*source) { println!("invalid source: {}", source); - *bad = true; + // *bad = true; } } } From 1e4a224e0c0a1ada2a275aa2f457ec44367bc47b Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Fri, 29 Mar 2019 15:23:41 +0100 Subject: [PATCH 06/16] Fix rustdoc --- src/librustdoc/test.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 0bbc7c5c4b223..ff8f45258a85b 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -698,20 +698,20 @@ impl Tester for Collector { &cratename, &filename, line, - cfgs, - libs, - cg, - externs, + cfgs.clone(), + libs.clone(), + cg.clone(), + externs.clone(), config.should_panic, config.no_run, config.test_harness, config.compile_fail, - config.error_codes, + config.error_codes.clone(), &opts, - maybe_sysroot, - linker, + maybe_sysroot.clone(), + linker.clone(), edition, - persist_doctests + persist_doctests.clone() ) }), }); From 0a36b4b41877fd9112a3be7567d734b104a2e939 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Sat, 30 Mar 2019 10:16:37 +0100 Subject: [PATCH 07/16] Remove unnecessary feature(asm) --- src/libtest/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 3710413939711..ebbaaf0ef5ff9 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -12,7 +12,6 @@ #![unstable(feature = "test", issue = "27812")] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))] -#![feature(asm)] #![feature(staged_api)] #![feature(test)] From 71dedadac29ac9afd5599e7d8f39ca4b110c1277 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Sat, 30 Mar 2019 10:33:04 +0100 Subject: [PATCH 08/16] Update Cargo.lock --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index f472c86521bac..cfcdaa71be966 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1324,7 +1324,7 @@ version = "0.0.2" source = "git+https://github.com/gnzlbg/libtest?branch=clippy_ci#719256356b565a138e0005cabbc56153e5902dca" dependencies = [ "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] From 128861638809b6d9f00f990092369f531d707d04 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Sat, 30 Mar 2019 11:40:06 +0100 Subject: [PATCH 09/16] Update Cargo.lock --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cfcdaa71be966..7b986e63d6025 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1321,7 +1321,7 @@ dependencies = [ [[package]] name = "libtest" version = "0.0.2" -source = "git+https://github.com/gnzlbg/libtest?branch=clippy_ci#719256356b565a138e0005cabbc56153e5902dca" +source = "git+https://github.com/gnzlbg/libtest?branch=clippy_ci#1e98ee4f3b0b6b3f099efd761e1a3d916418797d" dependencies = [ "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2089,7 +2089,7 @@ name = "rand_chacha" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2111,7 +2111,7 @@ name = "rand_hc" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2136,7 +2136,7 @@ name = "rand_xorshift" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] From 62effd318fff5653ac0a18dc551692289bbdcf7d Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Sat, 30 Mar 2019 13:33:35 +0100 Subject: [PATCH 10/16] Update Cargo.lock --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7b986e63d6025..b0f73b06c295a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1321,7 +1321,7 @@ dependencies = [ [[package]] name = "libtest" version = "0.0.2" -source = "git+https://github.com/gnzlbg/libtest?branch=clippy_ci#1e98ee4f3b0b6b3f099efd761e1a3d916418797d" +source = "git+https://github.com/gnzlbg/libtest?branch=clippy_ci#1f13f7dd286fd16c76bd61ddcbe162fca9f9d9d2" dependencies = [ "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2089,7 +2089,7 @@ name = "rand_chacha" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2111,7 +2111,7 @@ name = "rand_hc" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2136,7 +2136,7 @@ name = "rand_xorshift" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] From ee0a6b37382cd339fe4bb5b8d9e9d5795573e649 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Tue, 2 Apr 2019 09:48:14 +0200 Subject: [PATCH 11/16] Display name of crate requiring rustc_private --- src/librustc/middle/stability.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index ef1270d304523..065a0eeedb0df 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -429,12 +429,15 @@ impl<'a, 'tcx> Index<'tcx> { // while maintaining the invariant that all sysroot crates are unstable // by default and are unable to be used. if tcx.sess.opts.debugging_opts.force_unstable_if_unmarked { - let reason = "this crate is being loaded from the sysroot, an \ - unstable location; did you mean to load this crate \ - from crates.io via `Cargo.toml` instead?"; + let reason = format!( + "crate \"{}\" is being loaded from the sysroot, an \ + unstable location; did you mean to load this crate \ + from crates.io via `Cargo.toml` instead?", + tcx.crate_name(LOCAL_CRATE) + ); let stability = tcx.intern_stability(Stability { level: attr::StabilityLevel::Unstable { - reason: Some(Symbol::intern(reason)), + reason: Some(Symbol::intern(&reason)), issue: 27812, }, feature: Symbol::intern("rustc_private"), From 684974969577fd567335053d245fe861661e7218 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Tue, 2 Apr 2019 09:52:50 +0200 Subject: [PATCH 12/16] test is also a tool now --- src/bootstrap/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 2394ae7fb7913..606a17e9c5b48 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -336,7 +336,8 @@ pub enum Mode { impl Mode { pub fn is_tool(&self) -> bool { match self { - Mode::ToolBootstrap | Mode::ToolRustc | Mode::ToolStd => true, + Mode::ToolBootstrap | Mode::ToolRustc | Mode::ToolStd | + Mode::ToolTest => true, _ => false } } From 2e2da05eb6e1a3aef7bf5afd1582143a46266a75 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Tue, 2 Apr 2019 11:31:12 +0200 Subject: [PATCH 13/16] Test is a tool --- src/bootstrap/lib.rs | 2 +- .../feature-gate-rustc_private-libc.rs | 4 ++++ .../feature-gate-rustc_private-libc.stderr | 18 ++++++++++++++++++ src/test/ui/feature-gates/feature-gate-test.rs | 4 ++++ .../ui/feature-gates/feature-gate-test.stderr | 18 ++++++++++++++++++ src/test/ui/issues/issue-37887.stderr | 2 +- src/test/ui/rustc_private-libtest.rs | 4 ++++ src/test/ui/rustc_private-libtest.stderr | 9 +++++++++ 8 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 src/test/ui/feature-gates/feature-gate-rustc_private-libc.rs create mode 100644 src/test/ui/feature-gates/feature-gate-rustc_private-libc.stderr create mode 100644 src/test/ui/feature-gates/feature-gate-test.rs create mode 100644 src/test/ui/feature-gates/feature-gate-test.stderr create mode 100644 src/test/ui/rustc_private-libtest.rs create mode 100644 src/test/ui/rustc_private-libtest.stderr diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 606a17e9c5b48..bbc2f46e5458c 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -337,7 +337,7 @@ impl Mode { pub fn is_tool(&self) -> bool { match self { Mode::ToolBootstrap | Mode::ToolRustc | Mode::ToolStd | - Mode::ToolTest => true, + Mode::Test => true, _ => false } } diff --git a/src/test/ui/feature-gates/feature-gate-rustc_private-libc.rs b/src/test/ui/feature-gates/feature-gate-rustc_private-libc.rs new file mode 100644 index 0000000000000..58f0c6b651ad6 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-rustc_private-libc.rs @@ -0,0 +1,4 @@ +fn main() { + extern crate libc; //~ ERROR use of unstable + use libc::*; //~ ERROR unresolved import +} diff --git a/src/test/ui/feature-gates/feature-gate-rustc_private-libc.stderr b/src/test/ui/feature-gates/feature-gate-rustc_private-libc.stderr new file mode 100644 index 0000000000000..ca96bf2d2e19c --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-rustc_private-libc.stderr @@ -0,0 +1,18 @@ +error[E0432]: unresolved import `libc` + --> $DIR/feature-gate-rustc_private-libc.rs:3:9 + | +LL | use libc::*; + | ^^^^ maybe a missing `extern crate libc;`? + +error[E0658]: use of unstable library feature 'rustc_private': crate "libc" is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) + --> $DIR/feature-gate-rustc_private-libc.rs:2:5 + | +LL | extern crate libc; + | ^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(rustc_private)] to the crate attributes to enable + +error: aborting due to 2 previous errors + +Some errors occurred: E0432, E0658. +For more information about an error, try `rustc --explain E0432`. diff --git a/src/test/ui/feature-gates/feature-gate-test.rs b/src/test/ui/feature-gates/feature-gate-test.rs new file mode 100644 index 0000000000000..919f46d34c6d9 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-test.rs @@ -0,0 +1,4 @@ +fn main() { + extern crate test; //~ ERROR use of unstable + use test::*; //~ ERROR unresolved import +} diff --git a/src/test/ui/feature-gates/feature-gate-test.stderr b/src/test/ui/feature-gates/feature-gate-test.stderr new file mode 100644 index 0000000000000..65aafcaeeac9a --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-test.stderr @@ -0,0 +1,18 @@ +error[E0432]: unresolved import `test` + --> $DIR/feature-gate-test.rs:3:9 + | +LL | use test::*; + | ^^^^ maybe a missing `extern crate test;`? + +error[E0658]: use of unstable library feature 'test' (see issue #27812) + --> $DIR/feature-gate-test.rs:2:5 + | +LL | extern crate test; + | ^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(test)] to the crate attributes to enable + +error: aborting due to 2 previous errors + +Some errors occurred: E0432, E0658. +For more information about an error, try `rustc --explain E0432`. diff --git a/src/test/ui/issues/issue-37887.stderr b/src/test/ui/issues/issue-37887.stderr index 24543a5efaf13..30d6b95dcaeab 100644 --- a/src/test/ui/issues/issue-37887.stderr +++ b/src/test/ui/issues/issue-37887.stderr @@ -4,7 +4,7 @@ error[E0432]: unresolved import `libc` LL | use libc::*; | ^^^^ maybe a missing `extern crate libc;`? -error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) +error[E0658]: use of unstable library feature 'rustc_private': crate "libc" is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) --> $DIR/issue-37887.rs:2:5 | LL | extern crate libc; diff --git a/src/test/ui/rustc_private-libtest.rs b/src/test/ui/rustc_private-libtest.rs new file mode 100644 index 0000000000000..536c6da952028 --- /dev/null +++ b/src/test/ui/rustc_private-libtest.rs @@ -0,0 +1,4 @@ +fn main() { + extern crate libtest; + use libtest::*; //~ ERROR unresolved import +} diff --git a/src/test/ui/rustc_private-libtest.stderr b/src/test/ui/rustc_private-libtest.stderr new file mode 100644 index 0000000000000..d9398e4313b53 --- /dev/null +++ b/src/test/ui/rustc_private-libtest.stderr @@ -0,0 +1,9 @@ +error[E0432]: unresolved import `libtest` + --> $DIR/rustc_private-libtest.rs:3:9 + | +LL | use libtest::*; + | ^^^^^^^ maybe a missing `extern crate libtest;`? + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0432`. From d8b0f751908b8b03a61ccfe08085e7e77d984a5f Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Wed, 3 Apr 2019 17:51:50 +0200 Subject: [PATCH 14/16] Fix hash-stable-is-unstable test --- .../hash-stable-is-unstable.stderr | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/test/ui-fulldeps/hash-stable-is-unstable.stderr b/src/test/ui-fulldeps/hash-stable-is-unstable.stderr index e7007204d3895..52b29a92a03a1 100644 --- a/src/test/ui-fulldeps/hash-stable-is-unstable.stderr +++ b/src/test/ui-fulldeps/hash-stable-is-unstable.stderr @@ -2,7 +2,7 @@ error[E0601]: `main` function not found in crate `hash_stable_is_unstable` | = note: consider adding a `main` function to `$DIR/hash-stable-is-unstable.rs` -error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) +error[E0658]: use of unstable library feature 'rustc_private': crate "rustc_data_structures" is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) --> $DIR/hash-stable-is-unstable.rs:3:1 | LL | extern crate rustc_data_structures; @@ -10,7 +10,7 @@ LL | extern crate rustc_data_structures; | = help: add #![feature(rustc_private)] to the crate attributes to enable -error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) +error[E0658]: use of unstable library feature 'rustc_private': crate "rustc" is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) --> $DIR/hash-stable-is-unstable.rs:5:1 | LL | extern crate rustc; @@ -18,7 +18,7 @@ LL | extern crate rustc; | = help: add #![feature(rustc_private)] to the crate attributes to enable -error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) +error[E0658]: use of unstable library feature 'rustc_private': crate "rustc_macros" is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) --> $DIR/hash-stable-is-unstable.rs:7:1 | LL | extern crate rustc_macros; @@ -26,7 +26,7 @@ LL | extern crate rustc_macros; | = help: add #![feature(rustc_private)] to the crate attributes to enable -error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) +error[E0658]: use of unstable library feature 'rustc_private': crate "rustc_macros" is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) --> $DIR/hash-stable-is-unstable.rs:10:5 | LL | use rustc_macros::HashStable; @@ -34,7 +34,7 @@ LL | use rustc_macros::HashStable; | = help: add #![feature(rustc_private)] to the crate attributes to enable -error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) +error[E0658]: use of unstable library feature 'rustc_private': crate "rustc_data_structures" is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) --> $DIR/hash-stable-is-unstable.rs:13:10 | LL | #[derive(HashStable)] @@ -42,7 +42,15 @@ LL | #[derive(HashStable)] | = help: add #![feature(rustc_private)] to the crate attributes to enable -error: aborting due to 6 previous errors +error[E0658]: use of unstable library feature 'rustc_private': crate "rustc" is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) + --> $DIR/hash-stable-is-unstable.rs:13:10 + | +LL | #[derive(HashStable)] + | ^^^^^^^^^^ + | + = help: add #![feature(rustc_private)] to the crate attributes to enable + +error: aborting due to 7 previous errors Some errors occurred: E0601, E0658. For more information about an error, try `rustc --explain E0601`. From e3fe8babf15e5f4dca39bea0a3d035dc63834ecc Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Fri, 5 Apr 2019 10:27:39 +0200 Subject: [PATCH 15/16] Fix hash-stable-is-unstable test --- src/test/ui-fulldeps/hash-stable-is-unstable.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/ui-fulldeps/hash-stable-is-unstable.rs b/src/test/ui-fulldeps/hash-stable-is-unstable.rs index 9f67f642df1ce..448184757fe16 100644 --- a/src/test/ui-fulldeps/hash-stable-is-unstable.rs +++ b/src/test/ui-fulldeps/hash-stable-is-unstable.rs @@ -12,4 +12,5 @@ use rustc_macros::HashStable; #[derive(HashStable)] //~^ use of unstable library feature 'rustc_private' +//~| use of unstable library feature 'rustc_private' struct Test; From c10eb4fd4ca1d1fdb732b1b8a67be3b0cdd3c5d8 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Fri, 5 Apr 2019 16:47:57 +0200 Subject: [PATCH 16/16] Add rustc_private feature to the test crate --- src/libtest/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index ebbaaf0ef5ff9..7540fc6c79d5a 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -14,6 +14,7 @@ test(attr(deny(warnings))))] #![feature(staged_api)] #![feature(test)] +#![feature(rustc_private)] extern crate libtest;