Skip to content

Commit 345ba50

Browse files
alexcrichtonZoxc
authored andcommitted
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!
1 parent b0bd5f2 commit 345ba50

File tree

38 files changed

+18
-84
lines changed

38 files changed

+18
-84
lines changed

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

src/librustc/lib.rs

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

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

src/librustc_save_analysis/Cargo.toml

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

1211
[dependencies]
1312
log = "0.4"

src/librustc_target/Cargo.toml

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

1211
[dependencies]
1312
bitflags = "1.0"
1413
log = "0.4"
15-
rustc_cratesio_shim = { path = "../librustc_cratesio_shim" }
1614
rustc_data_structures = { path = "../librustc_data_structures" }
1715
serialize = { path = "../libserialize" }
1816
syntax_pos = { path = "../libsyntax_pos" }

src/librustc_target/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
#[allow(unused_extern_crates)]
2424
extern crate serialize as rustc_serialize; // used by deriving
2525

26-
// See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
27-
#[allow(unused_extern_crates)]
28-
extern crate rustc_cratesio_shim;
29-
3026
#[macro_use]
3127
extern crate rustc_data_structures;
3228

src/librustc_traits/Cargo.toml

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

1211
[dependencies]
1312
bitflags = "1.0"

src/librustc_typeck/Cargo.toml

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

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

src/libserialize/Cargo.toml

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

1211
[dependencies]
1312
indexmap = "1"

src/libsyntax/Cargo.toml

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

1212
[dependencies]
1313
bitflags = "1.0"

src/libsyntax_ext/Cargo.toml

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

1212
[dependencies]
1313
fmt_macros = { path = "../libfmt_macros" }

src/libsyntax_pos/Cargo.toml

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

1212
[dependencies]
1313
serialize = { path = "../libserialize" }

src/test/run-make-fulldeps/issue-19371/foo.rs

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
extern crate rustc;
44
extern crate rustc_interface;
5+
#[allow(unused_extern_crates)]
6+
extern crate rustc_driver;
57
extern crate syntax;
68

79
use rustc::session::DiagnosticOutput;

0 commit comments

Comments
 (0)