Skip to content

Commit 8a0c362

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 d21bebe commit 8a0c362

File tree

39 files changed

+17
-87
lines changed

39 files changed

+17
-87
lines changed

src/bootstrap/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,8 +1125,6 @@ impl Build {
11251125
/// `rust.save-toolstates` in `config.toml`. If unspecified, nothing will be
11261126
/// done. The file is updated immediately after this function completes.
11271127
pub fn save_toolstate(&self, tool: &str, state: ToolState) {
1128-
use std::io::{Seek, SeekFrom};
1129-
11301128
if let Some(ref path) = self.config.save_toolstates {
11311129
let mut file = t!(fs::OpenOptions::new()
11321130
.create(true)

src/libarena/Cargo.toml

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ edition = "2018"
77
[lib]
88
name = "fmt_macros"
99
path = "lib.rs"
10-
crate-type = ["dylib"]

src/libgraphviz/Cargo.toml

Lines changed: 0 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
#![feature(extern_types)]
4444
#![feature(nll)]
4545
#![feature(non_exhaustive)]
46-
#![feature(proc_macro_internals)]
4746
#![feature(optin_builtin_traits)]
4847
#![feature(range_is_empty)]
4948
#![feature(rustc_diagnostic_macros)]

src/librustc_allocator/Cargo.toml

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/librustc_cratesio_shim/src/lib.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/librustc_data_structures/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ 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
log = "0.4"
1515
jobserver_crate = { version = "0.1", package = "jobserver" }
1616
lazy_static = "1"
17-
rustc_cratesio_shim = { path = "../librustc_cratesio_shim" }
1817
serialize = { path = "../libserialize" }
1918
graphviz = { path = "../libgraphviz" }
2019
cfg-if = "0.1.2"

src/librustc_data_structures/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ extern crate libc;
3737
#[macro_use]
3838
extern crate cfg_if;
3939

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

4642
#[inline(never)]

src/librustc_errors/Cargo.toml

Lines changed: 1 addition & 2 deletions
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 4 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ 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" }

src/librustc_target/lib.rs

Lines changed: 0 additions & 4 deletions
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 0 additions & 1 deletion
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
smallvec = { version = "0.6.7", features = ["union", "may_dangle"] }

src/libsyntax/Cargo.toml

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 0 deletions
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)