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!
This commit is contained in:
Alex Crichton 2018-12-19 18:11:31 +01:00 committed by John Kåre Alsaker
parent b0bd5f236d
commit 345ba505ec
38 changed files with 18 additions and 84 deletions

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

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

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

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

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