Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc: Remove dylib crate type from most rustc crates #59800

Merged
merged 4 commits into from
Jul 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand All @@ -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]]
Expand Down Expand Up @@ -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)",
]

Expand Down Expand Up @@ -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]]
Expand Down Expand Up @@ -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"
Expand All @@ -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)",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion src/libarena/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ edition = "2018"
[lib]
name = "arena"
path = "lib.rs"
crate-type = ["dylib"]

[dependencies]
rustc_data_structures = { path = "../librustc_data_structures" }
Expand Down
1 change: 1 addition & 0 deletions src/libfmt_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ crate-type = ["dylib"]

[dependencies]
syntax_pos = { path = "../libsyntax_pos" }

Centril marked this conversation as resolved.
Show resolved Hide resolved
1 change: 0 additions & 1 deletion src/libgraphviz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ edition = "2018"
[lib]
name = "graphviz"
path = "lib.rs"
crate-type = ["dylib"]
32 changes: 1 addition & 31 deletions src/librustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2018"
[lib]
name = "rustc"
path = "lib.rs"
crate-type = ["dylib"]
doctest = false

[dependencies]
arena = { path = "../libarena" }
Expand Down Expand Up @@ -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"
7 changes: 2 additions & 5 deletions src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion src/librustc_allocator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ edition = "2018"

[lib]
path = "lib.rs"
crate-type = ["dylib"]
test = false

[dependencies]
Expand Down
1 change: 0 additions & 1 deletion src/librustc_apfloat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
3 changes: 0 additions & 3 deletions src/librustc_apfloat/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_borrowck/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ edition = "2018"
[lib]
name = "rustc_borrowck"
path = "lib.rs"
crate-type = ["dylib"]
test = false
doctest = false

[dependencies]
log = "0.4"
Expand Down
1 change: 1 addition & 0 deletions src/librustc_codegen_llvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/librustc_codegen_llvm/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/librustc_codegen_ssa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ edition = "2018"
[lib]
name = "rustc_codegen_ssa"
path = "lib.rs"
crate-type = ["dylib"]
test = false

[dependencies]
Expand Down
1 change: 0 additions & 1 deletion src/librustc_codegen_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ edition = "2018"
[lib]
name = "rustc_codegen_utils"
path = "lib.rs"
crate-type = ["dylib"]
test = false

[dependencies]
Expand Down
26 changes: 0 additions & 26 deletions src/librustc_cratesio_shim/Cargo.toml

This file was deleted.

11 changes: 0 additions & 11 deletions src/librustc_cratesio_shim/src/lib.rs

This file was deleted.

3 changes: 1 addition & 2 deletions src/librustc_data_structures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ edition = "2018"
[lib]
name = "rustc_data_structures"
path = "lib.rs"
crate-type = ["dylib"]
doctest = false

[dependencies]
ena = "0.13"
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"
Expand Down
4 changes: 0 additions & 4 deletions src/librustc_data_structures/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
3 changes: 1 addition & 2 deletions src/librustc_errors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion src/librustc_fs_util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ edition = "2018"
[lib]
name = "rustc_fs_util"
path = "lib.rs"
crate-type = ["dylib"]

[dependencies]
2 changes: 1 addition & 1 deletion src/librustc_incremental/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2018"
[lib]
name = "rustc_incremental"
path = "lib.rs"
crate-type = ["dylib"]
doctest = false

[dependencies]
graphviz = { path = "../libgraphviz" }
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2018"
[lib]
name = "rustc_interface"
path = "lib.rs"
crate-type = ["dylib"]
doctest = false

[dependencies]
log = "0.4"
Expand Down
1 change: 0 additions & 1 deletion src/librustc_lint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ edition = "2018"
[lib]
name = "rustc_lint"
path = "lib.rs"
crate-type = ["dylib"]

[dependencies]
log = "0.4"
Expand Down
4 changes: 0 additions & 4 deletions src/librustc_llvm/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "...")`.
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_metadata/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2018"
[lib]
name = "rustc_metadata"
path = "lib.rs"
crate-type = ["dylib"]
doctest = false

[dependencies]
flate2 = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2018"
[lib]
name = "rustc_mir"
path = "lib.rs"
crate-type = ["dylib"]
doctest = false

[dependencies]
arena = { path = "../libarena" }
Expand Down
1 change: 0 additions & 1 deletion src/librustc_passes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ edition = "2018"
[lib]
name = "rustc_passes"
path = "lib.rs"
crate-type = ["dylib"]

[dependencies]
log = "0.4"
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_plugin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2018"
[lib]
name = "rustc_plugin"
path = "lib.rs"
crate-type = ["dylib"]
doctest = false

[dependencies]
rustc = { path = "../librustc" }
Expand Down
1 change: 1 addition & 0 deletions src/librustc_plugin/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//! #![feature(rustc_private)]
//!
//! extern crate rustc_plugin;
//! extern crate rustc_driver;
//! extern crate syntax;
//! extern crate syntax_pos;
//!
Expand Down
1 change: 0 additions & 1 deletion src/librustc_privacy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ edition = "2018"
[lib]
name = "rustc_privacy"
path = "lib.rs"
crate-type = ["dylib"]

[dependencies]
rustc = { path = "../librustc" }
Expand Down
Loading