From 36a185ea75eb7b962172b10c045fbd5c3a93fcd4 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 19 Dec 2018 09:11:31 -0800 Subject: [PATCH] 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! --- Cargo.lock | 13 ----------- src/libarena/Cargo.toml | 3 +-- src/libfmt_macros/Cargo.toml | 1 - src/libgraphviz/Cargo.toml | 1 - src/librustc/Cargo.toml | 2 +- src/librustc_allocator/Cargo.toml | 1 - src/librustc_apfloat/Cargo.toml | 1 - src/librustc_apfloat/lib.rs | 3 --- src/librustc_borrowck/Cargo.toml | 4 ++-- 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 | 25 --------------------- src/librustc_cratesio_shim/src/lib.rs | 9 -------- 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_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_platform_intrinsics/Cargo.toml | 1 - src/librustc_plugin/Cargo.toml | 2 +- src/librustc_privacy/Cargo.toml | 3 +-- 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 +- 37 files changed, 17 insertions(+), 97 deletions(-) delete mode 100644 src/librustc_cratesio_shim/Cargo.toml delete mode 100644 src/librustc_cratesio_shim/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 1ea872cc34241..eb7f6c1bd5955 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2288,7 +2288,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.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2371,15 +2370,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" @@ -2392,7 +2382,6 @@ dependencies = [ "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_cratesio_shim 0.0.0", "serialize 0.0.0", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2439,7 +2428,6 @@ version = "0.0.0" dependencies = [ "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", @@ -2626,7 +2614,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", ] diff --git a/src/libarena/Cargo.toml b/src/libarena/Cargo.toml index e2af67dd92861..827a0410f8956 100644 --- a/src/libarena/Cargo.toml +++ b/src/libarena/Cargo.toml @@ -6,7 +6,6 @@ version = "0.0.0" [lib] name = "arena" path = "lib.rs" -crate-type = ["dylib"] [dependencies] -rustc_data_structures = { path = "../librustc_data_structures" } \ No newline at end of file +rustc_data_structures = { path = "../librustc_data_structures" } diff --git a/src/libfmt_macros/Cargo.toml b/src/libfmt_macros/Cargo.toml index b3f4d2deae2fc..7de4794e5de87 100644 --- a/src/libfmt_macros/Cargo.toml +++ b/src/libfmt_macros/Cargo.toml @@ -6,4 +6,3 @@ version = "0.0.0" [lib] name = "fmt_macros" path = "lib.rs" -crate-type = ["dylib"] diff --git a/src/libgraphviz/Cargo.toml b/src/libgraphviz/Cargo.toml index 76ef3a1d188ce..8cfffa106e881 100644 --- a/src/libgraphviz/Cargo.toml +++ b/src/libgraphviz/Cargo.toml @@ -6,4 +6,3 @@ version = "0.0.0" [lib] name = "graphviz" path = "lib.rs" -crate-type = ["dylib"] diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml index 504e016e5b803..5db494e98e879 100644 --- a/src/librustc/Cargo.toml +++ b/src/librustc/Cargo.toml @@ -6,7 +6,7 @@ version = "0.0.0" [lib] name = "rustc" path = "lib.rs" -crate-type = ["dylib"] +doctest = false [dependencies] arena = { path = "../libarena" } diff --git a/src/librustc_allocator/Cargo.toml b/src/librustc_allocator/Cargo.toml index 03d33f413c807..9cec7f9b507bb 100644 --- a/src/librustc_allocator/Cargo.toml +++ b/src/librustc_allocator/Cargo.toml @@ -5,7 +5,6 @@ version = "0.0.0" [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 248f2d71f41e5..1dbdac54f0f30 100644 --- a/src/librustc_apfloat/Cargo.toml +++ b/src/librustc_apfloat/Cargo.toml @@ -9,5 +9,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 6d2c54ca9ffe9..cc21842833b90 100644 --- a/src/librustc_apfloat/lib.rs +++ b/src/librustc_apfloat/lib.rs @@ -37,9 +37,6 @@ #![feature(nll)] #![feature(try_from)] -// See librustc_cratesio_shim/Cargo.toml for a comment explaining this. -#[allow(unused_extern_crates)] -extern crate rustc_cratesio_shim; #[macro_use] extern crate bitflags; diff --git a/src/librustc_borrowck/Cargo.toml b/src/librustc_borrowck/Cargo.toml index 3368bbf3855a5..8a88bf6050188 100644 --- a/src/librustc_borrowck/Cargo.toml +++ b/src/librustc_borrowck/Cargo.toml @@ -6,8 +6,8 @@ version = "0.0.0" [lib] name = "rustc_borrowck" path = "lib.rs" -crate-type = ["dylib"] test = false +doctest = false [dependencies] log = "0.4" @@ -17,4 +17,4 @@ graphviz = { path = "../libgraphviz" } rustc = { path = "../librustc" } rustc_mir = { path = "../librustc_mir" } rustc_errors = { path = "../librustc_errors" } -rustc_data_structures = { path = "../librustc_data_structures" } \ No newline at end of file +rustc_data_structures = { path = "../librustc_data_structures" } diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index 3205348fde33c..d273eb5182d3d 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -47,6 +47,7 @@ extern crate rustc_platform_intrinsics as intrinsics; extern crate rustc_codegen_utils; extern crate rustc_codegen_ssa; extern crate rustc_fs_util; +extern crate rustc_driver; #[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 50994497c2843..3dac08191866a 100644 --- a/src/librustc_codegen_ssa/Cargo.toml +++ b/src/librustc_codegen_ssa/Cargo.toml @@ -6,7 +6,6 @@ version = "0.0.0" [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 34a09f30b6411..a332a8bf97a41 100644 --- a/src/librustc_codegen_utils/Cargo.toml +++ b/src/librustc_codegen_utils/Cargo.toml @@ -6,7 +6,6 @@ version = "0.0.0" [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 b8e494e4040ec..0000000000000 --- a/src/librustc_cratesio_shim/Cargo.toml +++ /dev/null @@ -1,25 +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" - -[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 4024087f4d3ef..0000000000000 --- a/src/librustc_cratesio_shim/src/lib.rs +++ /dev/null @@ -1,9 +0,0 @@ -// 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 1754376a5d7f9..6b167ed5ac204 100644 --- a/src/librustc_data_structures/Cargo.toml +++ b/src/librustc_data_structures/Cargo.toml @@ -6,12 +6,11 @@ version = "0.0.0" [lib] name = "rustc_data_structures" path = "lib.rs" -crate-type = ["dylib"] +doctest = false [dependencies] ena = "0.11" log = "0.4" -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 c086eb3aa804f..5bef64bce2cf1 100644 --- a/src/librustc_data_structures/lib.rs +++ b/src/librustc_data_structures/lib.rs @@ -43,10 +43,6 @@ extern crate serialize; extern crate graphviz; extern crate smallvec; -// 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; #[macro_export] diff --git a/src/librustc_errors/Cargo.toml b/src/librustc_errors/Cargo.toml index b24f8ddf4d9f7..37115d12859af 100644 --- a/src/librustc_errors/Cargo.toml +++ b/src/librustc_errors/Cargo.toml @@ -6,14 +6,13 @@ version = "0.0.0" [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 e40b44204b349..013e94c26d1b3 100644 --- a/src/librustc_fs_util/Cargo.toml +++ b/src/librustc_fs_util/Cargo.toml @@ -6,6 +6,5 @@ version = "0.0.0" [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 b8519ee1ab1a5..dbcff91dba294 100644 --- a/src/librustc_incremental/Cargo.toml +++ b/src/librustc_incremental/Cargo.toml @@ -6,7 +6,7 @@ version = "0.0.0" [lib] name = "rustc_incremental" path = "lib.rs" -crate-type = ["dylib"] +doctest = false [dependencies] graphviz = { path = "../libgraphviz" } diff --git a/src/librustc_lint/Cargo.toml b/src/librustc_lint/Cargo.toml index 7fb7a06ea1ad5..56987a56faf2e 100644 --- a/src/librustc_lint/Cargo.toml +++ b/src/librustc_lint/Cargo.toml @@ -6,7 +6,6 @@ version = "0.0.0" [lib] name = "rustc_lint" path = "lib.rs" -crate-type = ["dylib"] test = false [dependencies] diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index ca66540fa25f7..4ac1cac870b47 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -5,10 +5,6 @@ html_favicon_url = "https://doc.rust-lang.org/favicon.ico", 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 337c87c24ba2b..7f9d50f1c9f84 100644 --- a/src/librustc_metadata/Cargo.toml +++ b/src/librustc_metadata/Cargo.toml @@ -6,7 +6,7 @@ version = "0.0.0" [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 f0234c48c3eca..dce3f78b4e204 100644 --- a/src/librustc_mir/Cargo.toml +++ b/src/librustc_mir/Cargo.toml @@ -6,7 +6,7 @@ version = "0.0.0" [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 2babb93eedbcf..d7704de04173a 100644 --- a/src/librustc_passes/Cargo.toml +++ b/src/librustc_passes/Cargo.toml @@ -6,7 +6,6 @@ version = "0.0.0" [lib] name = "rustc_passes" path = "lib.rs" -crate-type = ["dylib"] [dependencies] log = "0.4" diff --git a/src/librustc_platform_intrinsics/Cargo.toml b/src/librustc_platform_intrinsics/Cargo.toml index 92f37f974efdc..3d70446017740 100644 --- a/src/librustc_platform_intrinsics/Cargo.toml +++ b/src/librustc_platform_intrinsics/Cargo.toml @@ -6,4 +6,3 @@ version = "0.0.0" [lib] name = "rustc_platform_intrinsics" path = "lib.rs" -crate-type = ["dylib"] diff --git a/src/librustc_plugin/Cargo.toml b/src/librustc_plugin/Cargo.toml index d8fa1da1ce219..fee1640a28b7b 100644 --- a/src/librustc_plugin/Cargo.toml +++ b/src/librustc_plugin/Cargo.toml @@ -7,7 +7,7 @@ build = false [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 62eab40f3ec9a..55e7dddf23afd 100644 --- a/src/librustc_privacy/Cargo.toml +++ b/src/librustc_privacy/Cargo.toml @@ -6,11 +6,10 @@ version = "0.0.0" [lib] name = "rustc_privacy" path = "lib.rs" -crate-type = ["dylib"] [dependencies] rustc = { path = "../librustc" } rustc_typeck = { path = "../librustc_typeck" } syntax = { path = "../libsyntax" } syntax_pos = { path = "../libsyntax_pos" } -rustc_data_structures = { path = "../librustc_data_structures" } \ No newline at end of file +rustc_data_structures = { path = "../librustc_data_structures" } diff --git a/src/librustc_resolve/Cargo.toml b/src/librustc_resolve/Cargo.toml index 3a8e84a3280c6..af6cdc7e95d3a 100644 --- a/src/librustc_resolve/Cargo.toml +++ b/src/librustc_resolve/Cargo.toml @@ -6,8 +6,8 @@ version = "0.0.0" [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 e47f89c64ff07..2c14c6ac7a062 100644 --- a/src/librustc_save_analysis/Cargo.toml +++ b/src/librustc_save_analysis/Cargo.toml @@ -6,7 +6,6 @@ version = "0.0.0" [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 dfdd7f0ae58e5..e1ab472704928 100644 --- a/src/librustc_target/Cargo.toml +++ b/src/librustc_target/Cargo.toml @@ -6,11 +6,9 @@ version = "0.0.0" [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" } diff --git a/src/librustc_target/lib.rs b/src/librustc_target/lib.rs index 0df0027c171aa..5cea9faf5ec44 100644 --- a/src/librustc_target/lib.rs +++ b/src/librustc_target/lib.rs @@ -24,10 +24,6 @@ extern crate serialize; 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 bf946d39806ec..77f4eb8c86697 100644 --- a/src/librustc_traits/Cargo.toml +++ b/src/librustc_traits/Cargo.toml @@ -6,7 +6,6 @@ version = "0.0.0" [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 87f11b01a1d94..c019dc85ced2b 100644 --- a/src/librustc_typeck/Cargo.toml +++ b/src/librustc_typeck/Cargo.toml @@ -6,8 +6,8 @@ version = "0.0.0" [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 3e040818d3777..0d27716012a86 100644 --- a/src/libserialize/Cargo.toml +++ b/src/libserialize/Cargo.toml @@ -6,7 +6,6 @@ version = "0.0.0" [lib] name = "serialize" path = "lib.rs" -crate-type = ["dylib", "rlib"] [dependencies] smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } diff --git a/src/libsyntax/Cargo.toml b/src/libsyntax/Cargo.toml index fba2623e005d0..c45ab7651d64e 100644 --- a/src/libsyntax/Cargo.toml +++ b/src/libsyntax/Cargo.toml @@ -6,7 +6,7 @@ version = "0.0.0" [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 7ad08f75e8bdd..c05f5305ba09e 100644 --- a/src/libsyntax_ext/Cargo.toml +++ b/src/libsyntax_ext/Cargo.toml @@ -6,7 +6,7 @@ version = "0.0.0" [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 08ee2e0f37626..ea9d9eb1ac241 100644 --- a/src/libsyntax_pos/Cargo.toml +++ b/src/libsyntax_pos/Cargo.toml @@ -6,7 +6,7 @@ version = "0.0.0" [lib] name = "syntax_pos" path = "lib.rs" -crate-type = ["dylib"] +doctest = false [dependencies] serialize = { path = "../libserialize" }