about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-07-07 11:32:58 +0000
committerbors <bors@rust-lang.org>2019-07-07 11:32:58 +0000
commitdd2e8040a35883574ae0c4cc7a4e887ecb66469c (patch)
tree2df3e6dea1f773c9393c9feee18933759a665896
parentdbeed58adee2ef046b46b252980f86672f9bfc4c (diff)
parent7198687bb2df13a3298ef1e8f594753073d6b9e8 (diff)
downloadrust-dd2e8040a35883574ae0c4cc7a4e887ecb66469c.tar.gz
rust-dd2e8040a35883574ae0c4cc7a4e887ecb66469c.zip
Auto merge of #59800 - Zoxc:less-dylibs, r=alexcrichton
rustc: Remove `dylib` crate type from most rustc crates

Revival of https://github.com/rust-lang/rust/pull/56987

cc @alexcrichton
r? @michaelwoerister
-rw-r--r--Cargo.lock16
-rw-r--r--src/libarena/Cargo.toml1
-rw-r--r--src/libfmt_macros/Cargo.toml1
-rw-r--r--src/libgraphviz/Cargo.toml1
-rw-r--r--src/librustc/Cargo.toml32
-rw-r--r--src/librustc/lib.rs7
-rw-r--r--src/librustc_allocator/Cargo.toml1
-rw-r--r--src/librustc_apfloat/Cargo.toml1
-rw-r--r--src/librustc_apfloat/lib.rs3
-rw-r--r--src/librustc_borrowck/Cargo.toml2
-rw-r--r--src/librustc_codegen_llvm/Cargo.toml1
-rw-r--r--src/librustc_codegen_llvm/lib.rs1
-rw-r--r--src/librustc_codegen_ssa/Cargo.toml1
-rw-r--r--src/librustc_codegen_utils/Cargo.toml1
-rw-r--r--src/librustc_cratesio_shim/Cargo.toml26
-rw-r--r--src/librustc_cratesio_shim/src/lib.rs11
-rw-r--r--src/librustc_data_structures/Cargo.toml3
-rw-r--r--src/librustc_data_structures/lib.rs4
-rw-r--r--src/librustc_errors/Cargo.toml3
-rw-r--r--src/librustc_fs_util/Cargo.toml1
-rw-r--r--src/librustc_incremental/Cargo.toml2
-rw-r--r--src/librustc_interface/Cargo.toml2
-rw-r--r--src/librustc_lint/Cargo.toml1
-rw-r--r--src/librustc_llvm/lib.rs4
-rw-r--r--src/librustc_metadata/Cargo.toml2
-rw-r--r--src/librustc_mir/Cargo.toml2
-rw-r--r--src/librustc_passes/Cargo.toml1
-rw-r--r--src/librustc_plugin/Cargo.toml2
-rw-r--r--src/librustc_plugin/lib.rs1
-rw-r--r--src/librustc_privacy/Cargo.toml1
-rw-r--r--src/librustc_resolve/Cargo.toml2
-rw-r--r--src/librustc_save_analysis/Cargo.toml1
-rw-r--r--src/librustc_target/Cargo.toml2
-rw-r--r--src/librustc_target/lib.rs4
-rw-r--r--src/librustc_traits/Cargo.toml1
-rw-r--r--src/librustc_typeck/Cargo.toml2
-rw-r--r--src/libserialize/Cargo.toml1
-rw-r--r--src/libsyntax/Cargo.toml2
-rw-r--r--src/libsyntax_ext/Cargo.toml2
-rw-r--r--src/libsyntax_pos/Cargo.toml2
-rw-r--r--src/test/run-make-fulldeps/issue-19371/foo.rs2
-rw-r--r--src/test/run-pass-fulldeps/auxiliary/issue-40001-plugin.rs1
-rw-r--r--src/test/run-pass-fulldeps/auxiliary/lint-for-crate.rs1
-rw-r--r--src/test/run-pass-fulldeps/auxiliary/llvm-pass-plugin.rs1
-rw-r--r--src/test/run-pass-fulldeps/auxiliary/lto-syntax-extension-plugin.rs1
-rw-r--r--src/test/run-pass-fulldeps/auxiliary/macro-crate-test.rs1
-rw-r--r--src/test/run-pass-fulldeps/auxiliary/outlive-expansion-phase.rs1
-rw-r--r--src/test/run-pass-fulldeps/auxiliary/plugin-args.rs1
-rw-r--r--src/test/run-pass-fulldeps/auxiliary/roman-numerals.rs1
-rw-r--r--src/test/ui-fulldeps/auxiliary/attr-plugin-test.rs1
-rw-r--r--src/test/ui-fulldeps/auxiliary/lint-for-crate.rs1
-rw-r--r--src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs1
-rw-r--r--src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs1
-rw-r--r--src/test/ui-fulldeps/auxiliary/lint-tool-test.rs1
-rw-r--r--src/test/ui-fulldeps/auxiliary/rlib-crate-test.rs1
55 files changed, 37 insertions, 133 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 8f5461325c2..2efcd0ace13 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]]
@@ -3031,15 +3029,6 @@ dependencies = [
 ]
 
 [[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"
 dependencies = [
@@ -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",
diff --git a/src/libarena/Cargo.toml b/src/libarena/Cargo.toml
index aa1bf38b995..2643912f6d7 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 fc32f21ec4e..a95193b8595 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 a6a3c1a249d..4a6e41f7603 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 4d50e80d4cf..b6f3bc62dfd 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" }
@@ -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 b20f7120bbf..dc26140ace5 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)]
@@ -90,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_allocator/Cargo.toml b/src/librustc_allocator/Cargo.toml
index cf6c598bfb1..a964f323c9e 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 c7496a9547e..af6c2feed00 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 1b0bcdd0b5b..ceade5d2788 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 f293739dec7..e9abc17202e 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/Cargo.toml b/src/librustc_codegen_llvm/Cargo.toml
index 4ae8303c76d..291d32a0681 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"
diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs
index dbcb2031552..0f0b9f27917 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 a4cb517fafe..343596feed2 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 b218d18a06b..d93589ea84b 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 6bdfbe09354..00000000000
--- 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 4c170f4f5f6..00000000000
--- 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 cd792d31187..acddb3448ca 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 38dfb675237..b479643a5e8 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 3689a463a5c..4df9632cce2 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 47918643f31..e74e3809927 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 df971ec5bdb..9678cb4f655 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 bcaa4216109..82880d21987 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 fd2b635faef..041d0aaead9 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 292ce8b0a01..bdf6b091857 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 76aba33b6a4..e5c9f1bf205 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 5de5f5e7571..695bf1f077c 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 00bdcdc0cc0..de2476775b0 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 5e23aa0d7f7..7486281c1ea 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_plugin/lib.rs b/src/librustc_plugin/lib.rs
index cb6f8ebd82e..6520cdc3062 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/librustc_privacy/Cargo.toml b/src/librustc_privacy/Cargo.toml
index 5bf8024c569..7cf3a5d6dcd 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 8e3359c7752..548f982fe3b 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 767c726b761..88bb76d2aba 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 3ab25146331..f1b21365e4b 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 b65813fd8e3..c1ec4e59ef2 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 da19cc95eb9..bb28ac839a5 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 dcfcd74257e..ac396667683 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 fa31a68a75b..c302bcf95dc 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 b48f3c9b8b8..c5daa656476 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 773f0948a8a..eafbe6371a3 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 af7edc0a6bd..eebd25d1faf 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 0cbdf40e2f9..3c4f2cd541f 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;
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 64b795af926..ad42ee1d1ec 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 8c7bd7222e7..2826ae75bee 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 b5307446bca..1832fee4347 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 bd504425419..6e446241d55 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 a2b1d6976d0..d9b2740e476 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 25ad8caa37f..c22605afd0c 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 4cf8a4e33c5..7cbfef52b4a 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 4d9e0129e54..07302b6e68b 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 039124f31ff..86441b4f735 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 7656b15721a..a811edd37c6 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 941fe25b14c..3206ddee624 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 0deb1bf0915..4d57be49ca0 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 2a57876f464..ea7c75fbbe5 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 3df40df7b33..7a91b54bf6d 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;