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
This commit is contained in:
bors 2019-07-07 11:32:58 +00:00
commit dd2e8040a3
55 changed files with 37 additions and 133 deletions

View file

@ -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",

View file

@ -7,7 +7,6 @@ edition = "2018"
[lib]
name = "arena"
path = "lib.rs"
crate-type = ["dylib"]
[dependencies]
rustc_data_structures = { path = "../librustc_data_structures" }

View file

@ -11,3 +11,4 @@ crate-type = ["dylib"]
[dependencies]
syntax_pos = { path = "../libsyntax_pos" }

View file

@ -7,4 +7,3 @@ edition = "2018"
[lib]
name = "graphviz"
path = "lib.rs"
crate-type = ["dylib"]

View file

@ -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"

View file

@ -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;

View file

@ -6,7 +6,6 @@ edition = "2018"
[lib]
path = "lib.rs"
crate-type = ["dylib"]
test = false
[dependencies]

View file

@ -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"] }

View file

@ -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;

View file

@ -7,8 +7,8 @@ edition = "2018"
[lib]
name = "rustc_borrowck"
path = "lib.rs"
crate-type = ["dylib"]
test = false
doctest = false
[dependencies]
log = "0.4"

View file

@ -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"

View file

@ -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;

View file

@ -7,7 +7,6 @@ edition = "2018"
[lib]
name = "rustc_codegen_ssa"
path = "lib.rs"
crate-type = ["dylib"]
test = false
[dependencies]

View file

@ -7,7 +7,6 @@ edition = "2018"
[lib]
name = "rustc_codegen_utils"
path = "lib.rs"
crate-type = ["dylib"]
test = false
[dependencies]

View file

@ -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"

View file

@ -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;

View file

@ -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"

View file

@ -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)]

View file

@ -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"

View file

@ -7,6 +7,5 @@ edition = "2018"
[lib]
name = "rustc_fs_util"
path = "lib.rs"
crate-type = ["dylib"]
[dependencies]

View file

@ -7,7 +7,7 @@ edition = "2018"
[lib]
name = "rustc_incremental"
path = "lib.rs"
crate-type = ["dylib"]
doctest = false
[dependencies]
graphviz = { path = "../libgraphviz" }

View file

@ -7,7 +7,7 @@ edition = "2018"
[lib]
name = "rustc_interface"
path = "lib.rs"
crate-type = ["dylib"]
doctest = false
[dependencies]
log = "0.4"

View file

@ -7,7 +7,6 @@ edition = "2018"
[lib]
name = "rustc_lint"
path = "lib.rs"
crate-type = ["dylib"]
[dependencies]
log = "0.4"

View file

@ -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 = "...")`.

View file

@ -7,7 +7,7 @@ edition = "2018"
[lib]
name = "rustc_metadata"
path = "lib.rs"
crate-type = ["dylib"]
doctest = false
[dependencies]
flate2 = "1.0"

View file

@ -7,7 +7,7 @@ edition = "2018"
[lib]
name = "rustc_mir"
path = "lib.rs"
crate-type = ["dylib"]
doctest = false
[dependencies]
arena = { path = "../libarena" }

View file

@ -7,7 +7,6 @@ edition = "2018"
[lib]
name = "rustc_passes"
path = "lib.rs"
crate-type = ["dylib"]
[dependencies]
log = "0.4"

View file

@ -8,7 +8,7 @@ edition = "2018"
[lib]
name = "rustc_plugin"
path = "lib.rs"
crate-type = ["dylib"]
doctest = false
[dependencies]
rustc = { path = "../librustc" }

View file

@ -17,6 +17,7 @@
//! #![feature(rustc_private)]
//!
//! extern crate rustc_plugin;
//! extern crate rustc_driver;
//! extern crate syntax;
//! extern crate syntax_pos;
//!

View file

@ -7,7 +7,6 @@ edition = "2018"
[lib]
name = "rustc_privacy"
path = "lib.rs"
crate-type = ["dylib"]
[dependencies]
rustc = { path = "../librustc" }

View file

@ -7,8 +7,8 @@ edition = "2018"
[lib]
name = "rustc_resolve"
path = "lib.rs"
crate-type = ["dylib"]
test = false
doctest = false
[dependencies]
bitflags = "1.0"

View file

@ -7,7 +7,6 @@ edition = "2018"
[lib]
name = "rustc_save_analysis"
path = "lib.rs"
crate-type = ["dylib"]
[dependencies]
log = "0.4"

View file

@ -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" }

View file

@ -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;

View file

@ -7,7 +7,6 @@ edition = "2018"
[lib]
name = "rustc_traits"
path = "lib.rs"
crate-type = ["dylib"]
[dependencies]
bitflags = "1.0"

View file

@ -7,8 +7,8 @@ edition = "2018"
[lib]
name = "rustc_typeck"
path = "lib.rs"
crate-type = ["dylib"]
test = false
doctest = false
[dependencies]
arena = { path = "../libarena" }

View file

@ -7,7 +7,6 @@ edition = "2018"
[lib]
name = "serialize"
path = "lib.rs"
crate-type = ["dylib", "rlib"]
[dependencies]
indexmap = "1"

View file

@ -7,7 +7,7 @@ edition = "2018"
[lib]
name = "syntax"
path = "lib.rs"
crate-type = ["dylib"]
doctest = false
[dependencies]
bitflags = "1.0"

View file

@ -7,7 +7,7 @@ edition = "2018"
[lib]
name = "syntax_ext"
path = "lib.rs"
crate-type = ["dylib"]
doctest = false
[dependencies]
fmt_macros = { path = "../libfmt_macros" }

View file

@ -7,7 +7,7 @@ edition = "2018"
[lib]
name = "syntax_pos"
path = "lib.rs"
crate-type = ["dylib"]
doctest = false
[dependencies]
serialize = { path = "../libserialize" }

View file

@ -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;

View file

@ -4,6 +4,7 @@
#[macro_use]
extern crate rustc;
extern crate rustc_plugin;
extern crate rustc_driver;
extern crate syntax;
use rustc_plugin::Registry;

View file

@ -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};

View file

@ -5,6 +5,7 @@
extern crate rustc;
extern crate rustc_plugin;
extern crate rustc_driver;
use rustc_plugin::Registry;

View file

@ -5,6 +5,7 @@
extern crate rustc;
extern crate rustc_plugin;
extern crate rustc_driver;
use rustc_plugin::Registry;

View file

@ -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;

View file

@ -5,6 +5,7 @@
extern crate rustc;
extern crate rustc_plugin;
extern crate rustc_driver;
use std::any::Any;
use std::cell::RefCell;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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};

View file

@ -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};

View file

@ -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};

View file

@ -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;

View file

@ -5,6 +5,7 @@
extern crate rustc;
extern crate rustc_plugin;
extern crate rustc_driver;
use rustc_plugin::Registry;