From 345ba505ece1d0b9f929d43bd7dc37036ae3c580 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 19 Dec 2018 18:11:31 +0100 Subject: [PATCH 1/4] rustc: Remove `dylib` crate type from most rustc crates Now that procedural macros no longer link transitively to libsyntax, this shouldn't be needed any more! This commit is an experiment in removing all dynamic libraries from rustc except for librustc_driver itself. Let's see how far we can get with that! --- src/libarena/Cargo.toml | 1 - src/libfmt_macros/Cargo.toml | 1 + src/libgraphviz/Cargo.toml | 1 - src/librustc/Cargo.toml | 2 +- src/librustc/lib.rs | 1 - src/librustc_allocator/Cargo.toml | 1 - src/librustc_apfloat/Cargo.toml | 1 - src/librustc_apfloat/lib.rs | 3 --- src/librustc_borrowck/Cargo.toml | 2 +- src/librustc_codegen_llvm/lib.rs | 1 + src/librustc_codegen_ssa/Cargo.toml | 1 - src/librustc_codegen_utils/Cargo.toml | 1 - src/librustc_cratesio_shim/Cargo.toml | 26 ------------------- src/librustc_cratesio_shim/src/lib.rs | 11 -------- src/librustc_data_structures/Cargo.toml | 3 +-- src/librustc_data_structures/lib.rs | 4 --- src/librustc_errors/Cargo.toml | 3 +-- src/librustc_fs_util/Cargo.toml | 1 - src/librustc_incremental/Cargo.toml | 2 +- src/librustc_interface/Cargo.toml | 2 +- src/librustc_lint/Cargo.toml | 1 - src/librustc_llvm/lib.rs | 4 --- src/librustc_metadata/Cargo.toml | 2 +- src/librustc_mir/Cargo.toml | 2 +- src/librustc_passes/Cargo.toml | 1 - src/librustc_plugin/Cargo.toml | 2 +- src/librustc_privacy/Cargo.toml | 1 - src/librustc_resolve/Cargo.toml | 2 +- src/librustc_save_analysis/Cargo.toml | 1 - src/librustc_target/Cargo.toml | 2 -- src/librustc_target/lib.rs | 4 --- src/librustc_traits/Cargo.toml | 1 - src/librustc_typeck/Cargo.toml | 2 +- src/libserialize/Cargo.toml | 1 - src/libsyntax/Cargo.toml | 2 +- src/libsyntax_ext/Cargo.toml | 2 +- src/libsyntax_pos/Cargo.toml | 2 +- src/test/run-make-fulldeps/issue-19371/foo.rs | 2 ++ 38 files changed, 18 insertions(+), 84 deletions(-) delete mode 100644 src/librustc_cratesio_shim/Cargo.toml delete mode 100644 src/librustc_cratesio_shim/src/lib.rs diff --git a/src/libarena/Cargo.toml b/src/libarena/Cargo.toml index aa1bf38b99597..2643912f6d7d6 100644 --- a/src/libarena/Cargo.toml +++ b/src/libarena/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" [lib] name = "arena" path = "lib.rs" -crate-type = ["dylib"] [dependencies] rustc_data_structures = { path = "../librustc_data_structures" } diff --git a/src/libfmt_macros/Cargo.toml b/src/libfmt_macros/Cargo.toml index fc32f21ec4e0a..a95193b85952f 100644 --- a/src/libfmt_macros/Cargo.toml +++ b/src/libfmt_macros/Cargo.toml @@ -11,3 +11,4 @@ crate-type = ["dylib"] [dependencies] syntax_pos = { path = "../libsyntax_pos" } + diff --git a/src/libgraphviz/Cargo.toml b/src/libgraphviz/Cargo.toml index a6a3c1a249d64..4a6e41f760319 100644 --- a/src/libgraphviz/Cargo.toml +++ b/src/libgraphviz/Cargo.toml @@ -7,4 +7,3 @@ edition = "2018" [lib] name = "graphviz" path = "lib.rs" -crate-type = ["dylib"] diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml index 4d50e80d4cf67..7584df82ac6bc 100644 --- a/src/librustc/Cargo.toml +++ b/src/librustc/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [lib] name = "rustc" path = "lib.rs" -crate-type = ["dylib"] +doctest = false [dependencies] arena = { path = "../libarena" } diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index b20f7120bbfa2..8bedbefc0a681 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -46,7 +46,6 @@ #![feature(extern_types)] #![feature(nll)] #![feature(non_exhaustive)] -#![feature(proc_macro_internals)] #![feature(optin_builtin_traits)] #![feature(range_is_empty)] #![feature(rustc_diagnostic_macros)] diff --git a/src/librustc_allocator/Cargo.toml b/src/librustc_allocator/Cargo.toml index cf6c598bfb17b..a964f323c9e7d 100644 --- a/src/librustc_allocator/Cargo.toml +++ b/src/librustc_allocator/Cargo.toml @@ -6,7 +6,6 @@ edition = "2018" [lib] path = "lib.rs" -crate-type = ["dylib"] test = false [dependencies] diff --git a/src/librustc_apfloat/Cargo.toml b/src/librustc_apfloat/Cargo.toml index c7496a9547ea6..af6c2feed0072 100644 --- a/src/librustc_apfloat/Cargo.toml +++ b/src/librustc_apfloat/Cargo.toml @@ -10,5 +10,4 @@ path = "lib.rs" [dependencies] bitflags = "1.0" -rustc_cratesio_shim = { path = "../librustc_cratesio_shim" } smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } diff --git a/src/librustc_apfloat/lib.rs b/src/librustc_apfloat/lib.rs index 1b0bcdd0b5b48..ceade5d278838 100644 --- a/src/librustc_apfloat/lib.rs +++ b/src/librustc_apfloat/lib.rs @@ -35,9 +35,6 @@ #![deny(rust_2018_idioms)] #![feature(nll)] -// See librustc_cratesio_shim/Cargo.toml for a comment explaining this. -#[allow(unused_extern_crates)] -extern crate rustc_cratesio_shim; use std::cmp::Ordering; use std::fmt; diff --git a/src/librustc_borrowck/Cargo.toml b/src/librustc_borrowck/Cargo.toml index f293739dec727..e9abc17202e76 100644 --- a/src/librustc_borrowck/Cargo.toml +++ b/src/librustc_borrowck/Cargo.toml @@ -7,8 +7,8 @@ edition = "2018" [lib] name = "rustc_borrowck" path = "lib.rs" -crate-type = ["dylib"] test = false +doctest = false [dependencies] log = "0.4" diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index dbcb20315520b..0f0b9f279175c 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -39,6 +39,7 @@ extern crate rustc_incremental; extern crate rustc_codegen_utils; extern crate rustc_codegen_ssa; extern crate rustc_fs_util; +extern crate rustc_driver as _; #[macro_use] extern crate log; #[macro_use] extern crate syntax; diff --git a/src/librustc_codegen_ssa/Cargo.toml b/src/librustc_codegen_ssa/Cargo.toml index a4cb517fafed6..343596feed25f 100644 --- a/src/librustc_codegen_ssa/Cargo.toml +++ b/src/librustc_codegen_ssa/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" [lib] name = "rustc_codegen_ssa" path = "lib.rs" -crate-type = ["dylib"] test = false [dependencies] diff --git a/src/librustc_codegen_utils/Cargo.toml b/src/librustc_codegen_utils/Cargo.toml index b218d18a06ba7..d93589ea84be0 100644 --- a/src/librustc_codegen_utils/Cargo.toml +++ b/src/librustc_codegen_utils/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" [lib] name = "rustc_codegen_utils" path = "lib.rs" -crate-type = ["dylib"] test = false [dependencies] diff --git a/src/librustc_cratesio_shim/Cargo.toml b/src/librustc_cratesio_shim/Cargo.toml deleted file mode 100644 index 6bdfbe09354b4..0000000000000 --- a/src/librustc_cratesio_shim/Cargo.toml +++ /dev/null @@ -1,26 +0,0 @@ -# This crate exists to allow rustc to link certain crates from crates.io into -# the distribution. This doesn't work normally because: -# -# - Cargo always builds dependencies as rlibs: -# https://github.com/rust-lang/cargo/issues/629 -# - rustc wants to avoid multiple definitions of the same symbol, so it refuses -# to link multiple dylibs containing the same rlib -# - multiple dylibs depend on the same crates.io crates -# -# This solution works by including all the conflicting rlibs in a single dylib, -# which is then linked into all dylibs that depend on these crates.io crates. -# The result is that each rlib only appears once, and things work! - -[package] -authors = ["The Rust Project Developers"] -name = "rustc_cratesio_shim" -version = "0.0.0" -edition = "2018" - -[lib] -crate-type = ["dylib"] - -[dependencies] -bitflags = "1.0" -log = "0.4" -unicode-width = "0.1.4" diff --git a/src/librustc_cratesio_shim/src/lib.rs b/src/librustc_cratesio_shim/src/lib.rs deleted file mode 100644 index 4c170f4f5f6f9..0000000000000 --- a/src/librustc_cratesio_shim/src/lib.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![deny(rust_2018_idioms)] - -// See Cargo.toml for a comment explaining this crate. -#![allow(unused_extern_crates)] - -#![feature(nll)] - -extern crate bitflags; -extern crate log; -extern crate proc_macro; -extern crate unicode_width; diff --git a/src/librustc_data_structures/Cargo.toml b/src/librustc_data_structures/Cargo.toml index cd792d31187bd..acddb3448ca60 100644 --- a/src/librustc_data_structures/Cargo.toml +++ b/src/librustc_data_structures/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [lib] name = "rustc_data_structures" path = "lib.rs" -crate-type = ["dylib"] +doctest = false [dependencies] ena = "0.13" @@ -15,7 +15,6 @@ indexmap = "1" log = "0.4" jobserver_crate = { version = "0.1.13", package = "jobserver" } lazy_static = "1" -rustc_cratesio_shim = { path = "../librustc_cratesio_shim" } serialize = { path = "../libserialize" } graphviz = { path = "../libgraphviz" } cfg-if = "0.1.2" diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs index 38dfb675237b5..b479643a5e8cd 100644 --- a/src/librustc_data_structures/lib.rs +++ b/src/librustc_data_structures/lib.rs @@ -38,10 +38,6 @@ extern crate libc; #[macro_use] extern crate cfg_if; -// See librustc_cratesio_shim/Cargo.toml for a comment explaining this. -#[allow(unused_extern_crates)] -extern crate rustc_cratesio_shim; - pub use rustc_serialize::hex::ToHex; #[inline(never)] diff --git a/src/librustc_errors/Cargo.toml b/src/librustc_errors/Cargo.toml index 3689a463a5c84..4df9632cce26b 100644 --- a/src/librustc_errors/Cargo.toml +++ b/src/librustc_errors/Cargo.toml @@ -7,14 +7,13 @@ edition = "2018" [lib] name = "rustc_errors" path = "lib.rs" -crate-type = ["dylib"] +doctest = false [dependencies] log = "0.4" serialize = { path = "../libserialize" } syntax_pos = { path = "../libsyntax_pos" } rustc_data_structures = { path = "../librustc_data_structures" } -rustc_cratesio_shim = { path = "../librustc_cratesio_shim" } unicode-width = "0.1.4" atty = "0.2" termcolor = "1.0" diff --git a/src/librustc_fs_util/Cargo.toml b/src/librustc_fs_util/Cargo.toml index 47918643f31fe..e74e3809927a0 100644 --- a/src/librustc_fs_util/Cargo.toml +++ b/src/librustc_fs_util/Cargo.toml @@ -7,6 +7,5 @@ edition = "2018" [lib] name = "rustc_fs_util" path = "lib.rs" -crate-type = ["dylib"] [dependencies] diff --git a/src/librustc_incremental/Cargo.toml b/src/librustc_incremental/Cargo.toml index df971ec5bdb85..9678cb4f65545 100644 --- a/src/librustc_incremental/Cargo.toml +++ b/src/librustc_incremental/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [lib] name = "rustc_incremental" path = "lib.rs" -crate-type = ["dylib"] +doctest = false [dependencies] graphviz = { path = "../libgraphviz" } diff --git a/src/librustc_interface/Cargo.toml b/src/librustc_interface/Cargo.toml index bcaa4216109aa..82880d2198712 100644 --- a/src/librustc_interface/Cargo.toml +++ b/src/librustc_interface/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [lib] name = "rustc_interface" path = "lib.rs" -crate-type = ["dylib"] +doctest = false [dependencies] log = "0.4" diff --git a/src/librustc_lint/Cargo.toml b/src/librustc_lint/Cargo.toml index fd2b635faefb4..041d0aaead913 100644 --- a/src/librustc_lint/Cargo.toml +++ b/src/librustc_lint/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" [lib] name = "rustc_lint" path = "lib.rs" -crate-type = ["dylib"] [dependencies] log = "0.4" diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index 292ce8b0a01b0..bdf6b09185735 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -4,10 +4,6 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] -// See librustc_cratesio_shim/Cargo.toml for a comment explaining this. -#[allow(unused_extern_crates)] -extern crate rustc_cratesio_shim; - // NOTE: This crate only exists to allow linking on mingw targets. /// Initialize targets enabled by the build script via `cfg(llvm_component = "...")`. diff --git a/src/librustc_metadata/Cargo.toml b/src/librustc_metadata/Cargo.toml index 76aba33b6a404..e5c9f1bf2057b 100644 --- a/src/librustc_metadata/Cargo.toml +++ b/src/librustc_metadata/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [lib] name = "rustc_metadata" path = "lib.rs" -crate-type = ["dylib"] +doctest = false [dependencies] flate2 = "1.0" diff --git a/src/librustc_mir/Cargo.toml b/src/librustc_mir/Cargo.toml index 5de5f5e757119..695bf1f077cd2 100644 --- a/src/librustc_mir/Cargo.toml +++ b/src/librustc_mir/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [lib] name = "rustc_mir" path = "lib.rs" -crate-type = ["dylib"] +doctest = false [dependencies] arena = { path = "../libarena" } diff --git a/src/librustc_passes/Cargo.toml b/src/librustc_passes/Cargo.toml index 00bdcdc0cc021..de2476775b07e 100644 --- a/src/librustc_passes/Cargo.toml +++ b/src/librustc_passes/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" [lib] name = "rustc_passes" path = "lib.rs" -crate-type = ["dylib"] [dependencies] log = "0.4" diff --git a/src/librustc_plugin/Cargo.toml b/src/librustc_plugin/Cargo.toml index 5e23aa0d7f74e..7486281c1eac1 100644 --- a/src/librustc_plugin/Cargo.toml +++ b/src/librustc_plugin/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" [lib] name = "rustc_plugin" path = "lib.rs" -crate-type = ["dylib"] +doctest = false [dependencies] rustc = { path = "../librustc" } diff --git a/src/librustc_privacy/Cargo.toml b/src/librustc_privacy/Cargo.toml index 5bf8024c56911..7cf3a5d6dcde1 100644 --- a/src/librustc_privacy/Cargo.toml +++ b/src/librustc_privacy/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" [lib] name = "rustc_privacy" path = "lib.rs" -crate-type = ["dylib"] [dependencies] rustc = { path = "../librustc" } diff --git a/src/librustc_resolve/Cargo.toml b/src/librustc_resolve/Cargo.toml index 8e3359c775288..548f982fe3bf0 100644 --- a/src/librustc_resolve/Cargo.toml +++ b/src/librustc_resolve/Cargo.toml @@ -7,8 +7,8 @@ edition = "2018" [lib] name = "rustc_resolve" path = "lib.rs" -crate-type = ["dylib"] test = false +doctest = false [dependencies] bitflags = "1.0" diff --git a/src/librustc_save_analysis/Cargo.toml b/src/librustc_save_analysis/Cargo.toml index 767c726b761f2..88bb76d2aba3a 100644 --- a/src/librustc_save_analysis/Cargo.toml +++ b/src/librustc_save_analysis/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" [lib] name = "rustc_save_analysis" path = "lib.rs" -crate-type = ["dylib"] [dependencies] log = "0.4" diff --git a/src/librustc_target/Cargo.toml b/src/librustc_target/Cargo.toml index 3ab25146331c1..f1b21365e4bd4 100644 --- a/src/librustc_target/Cargo.toml +++ b/src/librustc_target/Cargo.toml @@ -7,12 +7,10 @@ edition = "2018" [lib] name = "rustc_target" path = "lib.rs" -crate-type = ["dylib"] [dependencies] bitflags = "1.0" log = "0.4" -rustc_cratesio_shim = { path = "../librustc_cratesio_shim" } rustc_data_structures = { path = "../librustc_data_structures" } serialize = { path = "../libserialize" } syntax_pos = { path = "../libsyntax_pos" } diff --git a/src/librustc_target/lib.rs b/src/librustc_target/lib.rs index b65813fd8e38d..c1ec4e59ef239 100644 --- a/src/librustc_target/lib.rs +++ b/src/librustc_target/lib.rs @@ -23,10 +23,6 @@ #[allow(unused_extern_crates)] extern crate serialize as rustc_serialize; // used by deriving -// See librustc_cratesio_shim/Cargo.toml for a comment explaining this. -#[allow(unused_extern_crates)] -extern crate rustc_cratesio_shim; - #[macro_use] extern crate rustc_data_structures; diff --git a/src/librustc_traits/Cargo.toml b/src/librustc_traits/Cargo.toml index da19cc95eb95a..bb28ac839a544 100644 --- a/src/librustc_traits/Cargo.toml +++ b/src/librustc_traits/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" [lib] name = "rustc_traits" path = "lib.rs" -crate-type = ["dylib"] [dependencies] bitflags = "1.0" diff --git a/src/librustc_typeck/Cargo.toml b/src/librustc_typeck/Cargo.toml index dcfcd74257e6f..ac3966676838a 100644 --- a/src/librustc_typeck/Cargo.toml +++ b/src/librustc_typeck/Cargo.toml @@ -7,8 +7,8 @@ edition = "2018" [lib] name = "rustc_typeck" path = "lib.rs" -crate-type = ["dylib"] test = false +doctest = false [dependencies] arena = { path = "../libarena" } diff --git a/src/libserialize/Cargo.toml b/src/libserialize/Cargo.toml index fa31a68a75b72..c302bcf95dcad 100644 --- a/src/libserialize/Cargo.toml +++ b/src/libserialize/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" [lib] name = "serialize" path = "lib.rs" -crate-type = ["dylib", "rlib"] [dependencies] indexmap = "1" diff --git a/src/libsyntax/Cargo.toml b/src/libsyntax/Cargo.toml index b48f3c9b8b8d8..c5daa6564767e 100644 --- a/src/libsyntax/Cargo.toml +++ b/src/libsyntax/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [lib] name = "syntax" path = "lib.rs" -crate-type = ["dylib"] +doctest = false [dependencies] bitflags = "1.0" diff --git a/src/libsyntax_ext/Cargo.toml b/src/libsyntax_ext/Cargo.toml index 773f0948a8a10..eafbe6371a3c5 100644 --- a/src/libsyntax_ext/Cargo.toml +++ b/src/libsyntax_ext/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [lib] name = "syntax_ext" path = "lib.rs" -crate-type = ["dylib"] +doctest = false [dependencies] fmt_macros = { path = "../libfmt_macros" } diff --git a/src/libsyntax_pos/Cargo.toml b/src/libsyntax_pos/Cargo.toml index af7edc0a6bd3e..eebd25d1fafd8 100644 --- a/src/libsyntax_pos/Cargo.toml +++ b/src/libsyntax_pos/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [lib] name = "syntax_pos" path = "lib.rs" -crate-type = ["dylib"] +doctest = false [dependencies] serialize = { path = "../libserialize" } diff --git a/src/test/run-make-fulldeps/issue-19371/foo.rs b/src/test/run-make-fulldeps/issue-19371/foo.rs index 0cbdf40e2f908..3c4f2cd541f4e 100644 --- a/src/test/run-make-fulldeps/issue-19371/foo.rs +++ b/src/test/run-make-fulldeps/issue-19371/foo.rs @@ -2,6 +2,8 @@ extern crate rustc; extern crate rustc_interface; +#[allow(unused_extern_crates)] +extern crate rustc_driver; extern crate syntax; use rustc::session::DiagnosticOutput; From 60c49bcb5520ed679287bb99437884cb6f946115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Tue, 9 Apr 2019 10:03:02 +0200 Subject: [PATCH 2/4] Remove some dummy dependencies --- src/librustc/Cargo.toml | 30 ---------------------------- src/librustc/lib.rs | 6 ++---- src/librustc_codegen_llvm/Cargo.toml | 1 + 3 files changed, 3 insertions(+), 34 deletions(-) diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml index 7584df82ac6bc..b6f3bc62dfd29 100644 --- a/src/librustc/Cargo.toml +++ b/src/librustc/Cargo.toml @@ -37,33 +37,3 @@ chalk-engine = { version = "0.9.0", default-features=false } rustc_fs_util = { path = "../librustc_fs_util" } smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } measureme = "0.3" - -# Note that these dependencies are a lie, they're just here to get linkage to -# work. -# -# We're creating a bunch of dylibs for the compiler but we're also compiling a -# bunch of crates.io crates. Everything in the compiler is compiled as an -# rlib/dylib pair but all crates.io crates tend to just be rlibs. This means -# we've got a problem for dependency graphs that look like: -# -# foo - rustc_codegen_llvm -# / \ -# rustc ---- rustc_driver -# \ / -# foo - rustc_metadata -# -# Here the crate `foo` is linked into the `rustc_codegen_llvm` and the -# `rustc_metadata` dylibs, meaning we've got duplicate copies! When we then -# go to link `rustc_driver` the compiler notices this and gives us a compiler -# error. -# -# To work around this problem we just add these crates.io dependencies to the -# `rustc` crate which is a shared dependency above. That way the crate `foo` -# shows up in the dylib for the `rustc` crate, deduplicating it and allowing -# crates like `rustc_codegen_llvm` to use `foo` *through* the `rustc` crate. -# -# tl;dr; this is not needed to get `rustc` to compile, but if you remove it then -# later crate stop compiling. If you can remove this and everything -# compiles, then please feel free to do so! -flate2 = "1.0" -tempfile = "3.0" diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 8bedbefc0a681..dc26140ace5a5 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -89,10 +89,8 @@ extern crate serialize as rustc_serialize; #[macro_use] extern crate smallvec; -// Note that librustc doesn't actually depend on these crates, see the note in -// `Cargo.toml` for this crate about why these are here. -#[allow(unused_extern_crates)] -extern crate flate2; +// Use the test crate here so we depend on getopts through it. This allow tools to link to both +// librustc_driver and libtest. #[allow(unused_extern_crates)] extern crate test; diff --git a/src/librustc_codegen_llvm/Cargo.toml b/src/librustc_codegen_llvm/Cargo.toml index 4ae8303c76d3c..291d32a06814d 100644 --- a/src/librustc_codegen_llvm/Cargo.toml +++ b/src/librustc_codegen_llvm/Cargo.toml @@ -13,6 +13,7 @@ test = false [dependencies] cc = "1.0.1" # Used to locate MSVC num_cpus = "1.0" +tempfile = "3.0" rustc-demangle = "0.1.15" rustc_llvm = { path = "../librustc_llvm" } memmap = "0.6" From 2caf5d9a5b45c324dcb412ea277fa2761e8e1920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Fri, 5 Jul 2019 12:23:51 +0200 Subject: [PATCH 3/4] Update Cargo.lock --- Cargo.lock | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8f5461325c21a..2efcd0ace1335 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2691,7 +2691,6 @@ dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "chalk-engine 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "fmt_macros 0.0.0", "graphviz 0.0.0", "jobserver 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2714,7 +2713,6 @@ dependencies = [ "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "syntax 0.0.0", "syntax_pos 0.0.0", - "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2946,7 +2944,6 @@ name = "rustc_apfloat" version = "0.0.0" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_cratesio_shim 0.0.0", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2984,6 +2981,7 @@ dependencies = [ "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_llvm 0.0.0", + "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3030,15 +3028,6 @@ dependencies = [ "syntax_pos 0.0.0", ] -[[package]] -name = "rustc_cratesio_shim" -version = "0.0.0" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rustc_data_structures" version = "0.0.0" @@ -3054,7 +3043,6 @@ dependencies = [ "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-rayon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-rayon-core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_cratesio_shim 0.0.0", "serialize 0.0.0", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3103,7 +3091,6 @@ dependencies = [ "annotate-snippets 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_cratesio_shim 0.0.0", "rustc_data_structures 0.0.0", "serialize 0.0.0", "syntax_pos 0.0.0", @@ -3333,7 +3320,6 @@ version = "0.0.0" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_cratesio_shim 0.0.0", "rustc_data_structures 0.0.0", "serialize 0.0.0", "syntax_pos 0.0.0", From 7198687bb2df13a3298ef1e8f594753073d6b9e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sat, 6 Jul 2019 19:56:20 +0200 Subject: [PATCH 4/4] Link compiler plugins to rustc_driver --- src/librustc_plugin/lib.rs | 1 + src/test/run-pass-fulldeps/auxiliary/issue-40001-plugin.rs | 1 + src/test/run-pass-fulldeps/auxiliary/lint-for-crate.rs | 1 + src/test/run-pass-fulldeps/auxiliary/llvm-pass-plugin.rs | 1 + .../run-pass-fulldeps/auxiliary/lto-syntax-extension-plugin.rs | 1 + src/test/run-pass-fulldeps/auxiliary/macro-crate-test.rs | 1 + src/test/run-pass-fulldeps/auxiliary/outlive-expansion-phase.rs | 1 + src/test/run-pass-fulldeps/auxiliary/plugin-args.rs | 1 + src/test/run-pass-fulldeps/auxiliary/roman-numerals.rs | 1 + src/test/ui-fulldeps/auxiliary/attr-plugin-test.rs | 1 + src/test/ui-fulldeps/auxiliary/lint-for-crate.rs | 1 + src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs | 1 + src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs | 1 + src/test/ui-fulldeps/auxiliary/lint-tool-test.rs | 1 + src/test/ui-fulldeps/auxiliary/rlib-crate-test.rs | 1 + 15 files changed, 15 insertions(+) diff --git a/src/librustc_plugin/lib.rs b/src/librustc_plugin/lib.rs index cb6f8ebd82e4e..6520cdc306203 100644 --- a/src/librustc_plugin/lib.rs +++ b/src/librustc_plugin/lib.rs @@ -17,6 +17,7 @@ //! #![feature(rustc_private)] //! //! extern crate rustc_plugin; +//! extern crate rustc_driver; //! extern crate syntax; //! extern crate syntax_pos; //! diff --git a/src/test/run-pass-fulldeps/auxiliary/issue-40001-plugin.rs b/src/test/run-pass-fulldeps/auxiliary/issue-40001-plugin.rs index 64b795af9267f..ad42ee1d1ec1e 100644 --- a/src/test/run-pass-fulldeps/auxiliary/issue-40001-plugin.rs +++ b/src/test/run-pass-fulldeps/auxiliary/issue-40001-plugin.rs @@ -4,6 +4,7 @@ #[macro_use] extern crate rustc; extern crate rustc_plugin; +extern crate rustc_driver; extern crate syntax; use rustc_plugin::Registry; diff --git a/src/test/run-pass-fulldeps/auxiliary/lint-for-crate.rs b/src/test/run-pass-fulldeps/auxiliary/lint-for-crate.rs index 8c7bd7222e73c..2826ae75bee2a 100644 --- a/src/test/run-pass-fulldeps/auxiliary/lint-for-crate.rs +++ b/src/test/run-pass-fulldeps/auxiliary/lint-for-crate.rs @@ -5,6 +5,7 @@ #[macro_use] extern crate rustc; extern crate rustc_plugin; +extern crate rustc_driver; extern crate syntax; use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray}; diff --git a/src/test/run-pass-fulldeps/auxiliary/llvm-pass-plugin.rs b/src/test/run-pass-fulldeps/auxiliary/llvm-pass-plugin.rs index b5307446bca05..1832fee434717 100644 --- a/src/test/run-pass-fulldeps/auxiliary/llvm-pass-plugin.rs +++ b/src/test/run-pass-fulldeps/auxiliary/llvm-pass-plugin.rs @@ -5,6 +5,7 @@ extern crate rustc; extern crate rustc_plugin; +extern crate rustc_driver; use rustc_plugin::Registry; diff --git a/src/test/run-pass-fulldeps/auxiliary/lto-syntax-extension-plugin.rs b/src/test/run-pass-fulldeps/auxiliary/lto-syntax-extension-plugin.rs index bd50442541990..6e446241d5579 100644 --- a/src/test/run-pass-fulldeps/auxiliary/lto-syntax-extension-plugin.rs +++ b/src/test/run-pass-fulldeps/auxiliary/lto-syntax-extension-plugin.rs @@ -5,6 +5,7 @@ extern crate rustc; extern crate rustc_plugin; +extern crate rustc_driver; use rustc_plugin::Registry; diff --git a/src/test/run-pass-fulldeps/auxiliary/macro-crate-test.rs b/src/test/run-pass-fulldeps/auxiliary/macro-crate-test.rs index a2b1d6976d0eb..d9b2740e47638 100644 --- a/src/test/run-pass-fulldeps/auxiliary/macro-crate-test.rs +++ b/src/test/run-pass-fulldeps/auxiliary/macro-crate-test.rs @@ -7,6 +7,7 @@ extern crate syntax; extern crate rustc; extern crate rustc_plugin; +extern crate rustc_driver; extern crate syntax_pos; extern crate proc_macro; diff --git a/src/test/run-pass-fulldeps/auxiliary/outlive-expansion-phase.rs b/src/test/run-pass-fulldeps/auxiliary/outlive-expansion-phase.rs index 25ad8caa37fac..c22605afd0c8d 100644 --- a/src/test/run-pass-fulldeps/auxiliary/outlive-expansion-phase.rs +++ b/src/test/run-pass-fulldeps/auxiliary/outlive-expansion-phase.rs @@ -5,6 +5,7 @@ extern crate rustc; extern crate rustc_plugin; +extern crate rustc_driver; use std::any::Any; use std::cell::RefCell; diff --git a/src/test/run-pass-fulldeps/auxiliary/plugin-args.rs b/src/test/run-pass-fulldeps/auxiliary/plugin-args.rs index 4cf8a4e33c526..7cbfef52b4aad 100644 --- a/src/test/run-pass-fulldeps/auxiliary/plugin-args.rs +++ b/src/test/run-pass-fulldeps/auxiliary/plugin-args.rs @@ -7,6 +7,7 @@ extern crate syntax; extern crate syntax_pos; extern crate rustc; extern crate rustc_plugin; +extern crate rustc_driver; use std::borrow::ToOwned; use syntax::ast; diff --git a/src/test/run-pass-fulldeps/auxiliary/roman-numerals.rs b/src/test/run-pass-fulldeps/auxiliary/roman-numerals.rs index 4d9e0129e54db..07302b6e68b31 100644 --- a/src/test/run-pass-fulldeps/auxiliary/roman-numerals.rs +++ b/src/test/run-pass-fulldeps/auxiliary/roman-numerals.rs @@ -13,6 +13,7 @@ extern crate syntax; extern crate syntax_pos; extern crate rustc; extern crate rustc_plugin; +extern crate rustc_driver; use syntax::parse::token::{self, Token}; use syntax::tokenstream::TokenTree; diff --git a/src/test/ui-fulldeps/auxiliary/attr-plugin-test.rs b/src/test/ui-fulldeps/auxiliary/attr-plugin-test.rs index 039124f31ff42..86441b4f73548 100644 --- a/src/test/ui-fulldeps/auxiliary/attr-plugin-test.rs +++ b/src/test/ui-fulldeps/auxiliary/attr-plugin-test.rs @@ -7,6 +7,7 @@ extern crate syntax; extern crate rustc; extern crate rustc_plugin; +extern crate rustc_driver; use syntax::symbol::Symbol; use syntax::feature_gate::AttributeType; diff --git a/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs b/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs index 7656b15721ada..a811edd37c67d 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs @@ -5,6 +5,7 @@ #[macro_use] extern crate rustc; extern crate rustc_plugin; +extern crate rustc_driver; extern crate syntax; use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray}; diff --git a/src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs b/src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs index 941fe25b14c70..3206ddee62475 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs @@ -7,6 +7,7 @@ #[macro_use] extern crate rustc; extern crate rustc_plugin; +extern crate rustc_driver; use rustc::hir; use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray}; diff --git a/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs b/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs index 0deb1bf091508..4d57be49ca061 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs @@ -9,6 +9,7 @@ extern crate syntax; #[macro_use] extern crate rustc; extern crate rustc_plugin; +extern crate rustc_driver; use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass, EarlyLintPassObject, LintArray}; diff --git a/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs b/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs index 2a57876f464c0..ea7c75fbbe5d5 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs @@ -7,6 +7,7 @@ extern crate syntax; #[macro_use] extern crate rustc; extern crate rustc_plugin; +extern crate rustc_driver; use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass}; use rustc_plugin::Registry; diff --git a/src/test/ui-fulldeps/auxiliary/rlib-crate-test.rs b/src/test/ui-fulldeps/auxiliary/rlib-crate-test.rs index 3df40df7b3317..7a91b54bf6d81 100644 --- a/src/test/ui-fulldeps/auxiliary/rlib-crate-test.rs +++ b/src/test/ui-fulldeps/auxiliary/rlib-crate-test.rs @@ -5,6 +5,7 @@ extern crate rustc; extern crate rustc_plugin; +extern crate rustc_driver; use rustc_plugin::Registry;