Skip to content

Commit a4d4d4a

Browse files
authored
Rollup merge of rust-lang#59800 - Zoxc:less-dylibs, r=alexcrichton
rustc: Remove `dylib` crate type from most rustc crates Revival of rust-lang#56987 cc @alexcrichton r? @michaelwoerister
2 parents 254f201 + b1efd0b commit a4d4d4a

File tree

40 files changed

+22
-133
lines changed

40 files changed

+22
-133
lines changed

Cargo.lock

+1-15
Original file line numberDiff line numberDiff line change
@@ -2469,7 +2469,6 @@ dependencies = [
24692469
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
24702470
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
24712471
"chalk-engine 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
2472-
"flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
24732472
"fmt_macros 0.0.0",
24742473
"graphviz 0.0.0",
24752474
"jobserver 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2492,7 +2491,6 @@ dependencies = [
24922491
"smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
24932492
"syntax 0.0.0",
24942493
"syntax_pos 0.0.0",
2495-
"tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
24962494
]
24972495

24982496
[[package]]
@@ -2724,7 +2722,6 @@ name = "rustc_apfloat"
27242722
version = "0.0.0"
27252723
dependencies = [
27262724
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
2727-
"rustc_cratesio_shim 0.0.0",
27282725
"smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
27292726
]
27302727

@@ -2762,6 +2759,7 @@ dependencies = [
27622759
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
27632760
"rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
27642761
"rustc_llvm 0.0.0",
2762+
"tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
27652763
]
27662764

27672765
[[package]]
@@ -2808,15 +2806,6 @@ dependencies = [
28082806
"syntax_pos 0.0.0",
28092807
]
28102808

2811-
[[package]]
2812-
name = "rustc_cratesio_shim"
2813-
version = "0.0.0"
2814-
dependencies = [
2815-
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
2816-
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
2817-
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
2818-
]
2819-
28202809
[[package]]
28212810
name = "rustc_data_structures"
28222811
version = "0.0.0"
@@ -2832,7 +2821,6 @@ dependencies = [
28322821
"rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
28332822
"rustc-rayon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
28342823
"rustc-rayon-core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
2835-
"rustc_cratesio_shim 0.0.0",
28362824
"serialize 0.0.0",
28372825
"smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
28382826
"stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2881,7 +2869,6 @@ dependencies = [
28812869
"annotate-snippets 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
28822870
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
28832871
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
2884-
"rustc_cratesio_shim 0.0.0",
28852872
"rustc_data_structures 0.0.0",
28862873
"serialize 0.0.0",
28872874
"syntax_pos 0.0.0",
@@ -3111,7 +3098,6 @@ version = "0.0.0"
31113098
dependencies = [
31123099
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
31133100
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
3114-
"rustc_cratesio_shim 0.0.0",
31153101
"rustc_data_structures 0.0.0",
31163102
"serialize 0.0.0",
31173103
"syntax_pos 0.0.0",

src/libarena/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ edition = "2018"
77
[lib]
88
name = "arena"
99
path = "lib.rs"
10-
crate-type = ["dylib"]
1110

1211
[dependencies]
1312
rustc_data_structures = { path = "../librustc_data_structures" }

src/libfmt_macros/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ crate-type = ["dylib"]
1111

1212
[dependencies]
1313
syntax_pos = { path = "../libsyntax_pos" }
14+

src/libgraphviz/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ edition = "2018"
77
[lib]
88
name = "graphviz"
99
path = "lib.rs"
10-
crate-type = ["dylib"]

src/librustc/Cargo.toml

+1-31
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2018"
77
[lib]
88
name = "rustc"
99
path = "lib.rs"
10-
crate-type = ["dylib"]
10+
doctest = false
1111

1212
[dependencies]
1313
arena = { path = "../libarena" }
@@ -37,33 +37,3 @@ chalk-engine = { version = "0.9.0", default-features=false }
3737
rustc_fs_util = { path = "../librustc_fs_util" }
3838
smallvec = { version = "0.6.7", features = ["union", "may_dangle"] }
3939
measureme = "0.3"
40-
41-
# Note that these dependencies are a lie, they're just here to get linkage to
42-
# work.
43-
#
44-
# We're creating a bunch of dylibs for the compiler but we're also compiling a
45-
# bunch of crates.io crates. Everything in the compiler is compiled as an
46-
# rlib/dylib pair but all crates.io crates tend to just be rlibs. This means
47-
# we've got a problem for dependency graphs that look like:
48-
#
49-
# foo - rustc_codegen_llvm
50-
# / \
51-
# rustc ---- rustc_driver
52-
# \ /
53-
# foo - rustc_metadata
54-
#
55-
# Here the crate `foo` is linked into the `rustc_codegen_llvm` and the
56-
# `rustc_metadata` dylibs, meaning we've got duplicate copies! When we then
57-
# go to link `rustc_driver` the compiler notices this and gives us a compiler
58-
# error.
59-
#
60-
# To work around this problem we just add these crates.io dependencies to the
61-
# `rustc` crate which is a shared dependency above. That way the crate `foo`
62-
# shows up in the dylib for the `rustc` crate, deduplicating it and allowing
63-
# crates like `rustc_codegen_llvm` to use `foo` *through* the `rustc` crate.
64-
#
65-
# tl;dr; this is not needed to get `rustc` to compile, but if you remove it then
66-
# later crate stop compiling. If you can remove this and everything
67-
# compiles, then please feel free to do so!
68-
flate2 = "1.0"
69-
tempfile = "3.0"

src/librustc/lib.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
#![feature(extern_types)]
4747
#![feature(nll)]
4848
#![feature(non_exhaustive)]
49-
#![feature(proc_macro_internals)]
5049
#![feature(optin_builtin_traits)]
5150
#![feature(range_is_empty)]
5251
#![feature(rustc_diagnostic_macros)]
@@ -90,10 +89,8 @@ extern crate serialize as rustc_serialize;
9089

9190
#[macro_use] extern crate smallvec;
9291

93-
// Note that librustc doesn't actually depend on these crates, see the note in
94-
// `Cargo.toml` for this crate about why these are here.
95-
#[allow(unused_extern_crates)]
96-
extern crate flate2;
92+
// Use the test crate here so we depend on getopts through it. This allow tools to link to both
93+
// librustc_driver and libtest.
9794
#[allow(unused_extern_crates)]
9895
extern crate test;
9996

src/librustc_allocator/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ edition = "2018"
66

77
[lib]
88
path = "lib.rs"
9-
crate-type = ["dylib"]
109
test = false
1110

1211
[dependencies]

src/librustc_apfloat/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ path = "lib.rs"
1010

1111
[dependencies]
1212
bitflags = "1.0"
13-
rustc_cratesio_shim = { path = "../librustc_cratesio_shim" }
1413
smallvec = { version = "0.6.7", features = ["union", "may_dangle"] }

src/librustc_apfloat/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@
3535
#![deny(rust_2018_idioms)]
3636

3737
#![feature(nll)]
38-
// See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
39-
#[allow(unused_extern_crates)]
40-
extern crate rustc_cratesio_shim;
4138

4239
use std::cmp::Ordering;
4340
use std::fmt;

src/librustc_borrowck/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ edition = "2018"
77
[lib]
88
name = "rustc_borrowck"
99
path = "lib.rs"
10-
crate-type = ["dylib"]
1110
test = false
11+
doctest = false
1212

1313
[dependencies]
1414
log = "0.4"

src/librustc_codegen_llvm/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ test = false
1313
[dependencies]
1414
cc = "1.0.1" # Used to locate MSVC
1515
num_cpus = "1.0"
16+
tempfile = "3.0"
1617
rustc-demangle = "0.1.15"
1718
rustc_llvm = { path = "../librustc_llvm" }
1819
memmap = "0.6"

src/librustc_codegen_llvm/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ extern crate rustc_incremental;
3939
extern crate rustc_codegen_utils;
4040
extern crate rustc_codegen_ssa;
4141
extern crate rustc_fs_util;
42+
extern crate rustc_driver as _;
4243

4344
#[macro_use] extern crate log;
4445
#[macro_use] extern crate syntax;

src/librustc_codegen_ssa/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ edition = "2018"
77
[lib]
88
name = "rustc_codegen_ssa"
99
path = "lib.rs"
10-
crate-type = ["dylib"]
1110
test = false
1211

1312
[dependencies]

src/librustc_codegen_utils/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ edition = "2018"
77
[lib]
88
name = "rustc_codegen_utils"
99
path = "lib.rs"
10-
crate-type = ["dylib"]
1110
test = false
1211

1312
[dependencies]

src/librustc_cratesio_shim/Cargo.toml

-26
This file was deleted.

src/librustc_cratesio_shim/src/lib.rs

-11
This file was deleted.

src/librustc_data_structures/Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ edition = "2018"
77
[lib]
88
name = "rustc_data_structures"
99
path = "lib.rs"
10-
crate-type = ["dylib"]
10+
doctest = false
1111

1212
[dependencies]
1313
ena = "0.13"
1414
indexmap = "1"
1515
log = "0.4"
1616
jobserver_crate = { version = "0.1.13", package = "jobserver" }
1717
lazy_static = "1"
18-
rustc_cratesio_shim = { path = "../librustc_cratesio_shim" }
1918
serialize = { path = "../libserialize" }
2019
graphviz = { path = "../libgraphviz" }
2120
cfg-if = "0.1.2"

src/librustc_data_structures/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ extern crate libc;
3838
#[macro_use]
3939
extern crate cfg_if;
4040

41-
// See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
42-
#[allow(unused_extern_crates)]
43-
extern crate rustc_cratesio_shim;
44-
4541
pub use rustc_serialize::hex::ToHex;
4642

4743
#[inline(never)]

src/librustc_errors/Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ edition = "2018"
77
[lib]
88
name = "rustc_errors"
99
path = "lib.rs"
10-
crate-type = ["dylib"]
10+
doctest = false
1111

1212
[dependencies]
1313
log = "0.4"
1414
serialize = { path = "../libserialize" }
1515
syntax_pos = { path = "../libsyntax_pos" }
1616
rustc_data_structures = { path = "../librustc_data_structures" }
17-
rustc_cratesio_shim = { path = "../librustc_cratesio_shim" }
1817
unicode-width = "0.1.4"
1918
atty = "0.2"
2019
termcolor = "1.0"

src/librustc_fs_util/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ edition = "2018"
77
[lib]
88
name = "rustc_fs_util"
99
path = "lib.rs"
10-
crate-type = ["dylib"]
1110

1211
[dependencies]

src/librustc_incremental/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2018"
77
[lib]
88
name = "rustc_incremental"
99
path = "lib.rs"
10-
crate-type = ["dylib"]
10+
doctest = false
1111

1212
[dependencies]
1313
graphviz = { path = "../libgraphviz" }

src/librustc_interface/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2018"
77
[lib]
88
name = "rustc_interface"
99
path = "lib.rs"
10-
crate-type = ["dylib"]
10+
doctest = false
1111

1212
[dependencies]
1313
log = "0.4"

src/librustc_lint/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ edition = "2018"
77
[lib]
88
name = "rustc_lint"
99
path = "lib.rs"
10-
crate-type = ["dylib"]
1110

1211
[dependencies]
1312
log = "0.4"

src/librustc_llvm/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44

55
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
66

7-
// See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
8-
#[allow(unused_extern_crates)]
9-
extern crate rustc_cratesio_shim;
10-
117
// NOTE: This crate only exists to allow linking on mingw targets.
128

139
/// Initialize targets enabled by the build script via `cfg(llvm_component = "...")`.

src/librustc_metadata/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2018"
77
[lib]
88
name = "rustc_metadata"
99
path = "lib.rs"
10-
crate-type = ["dylib"]
10+
doctest = false
1111

1212
[dependencies]
1313
flate2 = "1.0"

src/librustc_mir/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2018"
77
[lib]
88
name = "rustc_mir"
99
path = "lib.rs"
10-
crate-type = ["dylib"]
10+
doctest = false
1111

1212
[dependencies]
1313
arena = { path = "../libarena" }

src/librustc_passes/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ edition = "2018"
77
[lib]
88
name = "rustc_passes"
99
path = "lib.rs"
10-
crate-type = ["dylib"]
1110

1211
[dependencies]
1312
log = "0.4"

src/librustc_plugin/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ edition = "2018"
88
[lib]
99
name = "rustc_plugin"
1010
path = "lib.rs"
11-
crate-type = ["dylib"]
11+
doctest = false
1212

1313
[dependencies]
1414
rustc = { path = "../librustc" }

src/librustc_privacy/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ edition = "2018"
77
[lib]
88
name = "rustc_privacy"
99
path = "lib.rs"
10-
crate-type = ["dylib"]
1110

1211
[dependencies]
1312
rustc = { path = "../librustc" }

src/librustc_resolve/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ edition = "2018"
77
[lib]
88
name = "rustc_resolve"
99
path = "lib.rs"
10-
crate-type = ["dylib"]
1110
test = false
11+
doctest = false
1212

1313
[dependencies]
1414
bitflags = "1.0"

0 commit comments

Comments
 (0)