Skip to content

Commit 1d23332

Browse files
committed
Use -Wunused_crate_dependencies for compiler crates.
It's very useful. There are some false positives involving integration tests in `rustc_pattern_analysis` and `rustc_serialize`; subsequent commits will fix these. There is also a false positive involving `rustc_driver_impl`'s `rustc_randomized_layouts` feature. And I removed a `rustc_span` mention in a doc comment in `rustc_log` because it wasn't integral to the comment but caused a dev-dependency.
1 parent 249cb84 commit 1d23332

File tree

25 files changed

+41
-45
lines changed

25 files changed

+41
-45
lines changed

Cargo.lock

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3228,7 +3228,6 @@ dependencies = [
32283228
"rustc_index",
32293229
"rustc_macros",
32303230
"rustc_middle",
3231-
"rustc_parse",
32323231
"rustc_session",
32333232
"rustc_span",
32343233
"rustc_target",
@@ -3263,7 +3262,6 @@ version = "0.0.0"
32633262
dependencies = [
32643263
"itertools",
32653264
"rustc_ast",
3266-
"rustc_data_structures",
32673265
"rustc_lexer",
32683266
"rustc_span",
32693267
"thin-vec",
@@ -3291,15 +3289,12 @@ dependencies = [
32913289
"rustc_ast",
32923290
"rustc_ast_pretty",
32933291
"rustc_attr_data_structures",
3294-
"rustc_data_structures",
32953292
"rustc_errors",
32963293
"rustc_feature",
32973294
"rustc_fluent_macro",
32983295
"rustc_hir",
32993296
"rustc_lexer",
33003297
"rustc_macros",
3301-
"rustc_middle",
3302-
"rustc_serialize",
33033298
"rustc_session",
33043299
"rustc_span",
33053300
"thin-vec",
@@ -3426,15 +3421,13 @@ dependencies = [
34263421
"rustc_abi",
34273422
"rustc_arena",
34283423
"rustc_ast",
3429-
"rustc_ast_pretty",
34303424
"rustc_attr_parsing",
34313425
"rustc_data_structures",
34323426
"rustc_errors",
34333427
"rustc_fluent_macro",
34343428
"rustc_fs_util",
34353429
"rustc_hashes",
34363430
"rustc_hir",
3437-
"rustc_hir_pretty",
34383431
"rustc_incremental",
34393432
"rustc_index",
34403433
"rustc_macros",
@@ -3886,7 +3879,6 @@ dependencies = [
38863879
"rustc_query_impl",
38873880
"rustc_query_system",
38883881
"rustc_resolve",
3889-
"rustc_serialize",
38903882
"rustc_session",
38913883
"rustc_span",
38923884
"rustc_symbol_mangling",
@@ -3962,7 +3954,6 @@ dependencies = [
39623954
name = "rustc_log"
39633955
version = "0.0.0"
39643956
dependencies = [
3965-
"rustc_span",
39663957
"tracing",
39673958
"tracing-core",
39683959
"tracing-subscriber",
@@ -4052,13 +4043,11 @@ dependencies = [
40524043
name = "rustc_mir_build"
40534044
version = "0.0.0"
40544045
dependencies = [
4055-
"either",
40564046
"itertools",
40574047
"rustc_abi",
40584048
"rustc_apfloat",
40594049
"rustc_arena",
40604050
"rustc_ast",
4061-
"rustc_attr_parsing",
40624051
"rustc_data_structures",
40634052
"rustc_errors",
40644053
"rustc_fluent_macro",
@@ -4265,7 +4254,6 @@ name = "rustc_query_impl"
42654254
version = "0.0.0"
42664255
dependencies = [
42674256
"measureme",
4268-
"rustc_attr_data_structures",
42694257
"rustc_data_structures",
42704258
"rustc_errors",
42714259
"rustc_hashes",
@@ -4339,7 +4327,6 @@ version = "0.0.0"
43394327
dependencies = [
43404328
"bitflags",
43414329
"rustc_abi",
4342-
"rustc_ast",
43434330
"rustc_data_structures",
43444331
"rustc_hir",
43454332
"rustc_middle",
@@ -4394,7 +4381,6 @@ name = "rustc_smir"
43944381
version = "0.0.0"
43954382
dependencies = [
43964383
"rustc_abi",
4397-
"rustc_ast",
43984384
"rustc_data_structures",
43994385
"rustc_hir",
44004386
"rustc_hir_pretty",
@@ -4436,7 +4422,6 @@ dependencies = [
44364422
"punycode",
44374423
"rustc-demangle",
44384424
"rustc_abi",
4439-
"rustc_ast",
44404425
"rustc_data_structures",
44414426
"rustc_errors",
44424427
"rustc_hashes",
@@ -4531,7 +4516,6 @@ version = "0.0.0"
45314516
dependencies = [
45324517
"itertools",
45334518
"rustc_abi",
4534-
"rustc_attr_parsing",
45354519
"rustc_data_structures",
45364520
"rustc_errors",
45374521
"rustc_fluent_macro",

compiler/rustc_ast_lowering/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ rustc_hir = { path = "../rustc_hir" }
2020
rustc_index = { path = "../rustc_index" }
2121
rustc_macros = { path = "../rustc_macros" }
2222
rustc_middle = { path = "../rustc_middle" }
23-
rustc_parse = { path = "../rustc_parse" }
2423
rustc_session = { path = "../rustc_session" }
2524
rustc_span = { path = "../rustc_span" }
2625
rustc_target = { path = "../rustc_target" }

compiler/rustc_ast_pretty/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ edition = "2024"
77
# tidy-alphabetical-start
88
itertools = "0.12"
99
rustc_ast = { path = "../rustc_ast" }
10-
rustc_data_structures = { path = "../rustc_data_structures" }
1110
rustc_lexer = { path = "../rustc_lexer" }
1211
rustc_span = { path = "../rustc_span" }
12+
# tidy-alphabetical-end
13+
14+
[dev-dependencies]
15+
# tidy-alphabetical-start
1316
thin-vec = "0.2.12"
1417
# tidy-alphabetical-end

compiler/rustc_attr_parsing/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,12 @@ rustc_abi = { path = "../rustc_abi" }
99
rustc_ast = { path = "../rustc_ast" }
1010
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
1111
rustc_attr_data_structures = { path = "../rustc_attr_data_structures" }
12-
rustc_data_structures = { path = "../rustc_data_structures" }
1312
rustc_errors = { path = "../rustc_errors" }
1413
rustc_feature = { path = "../rustc_feature" }
1514
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
1615
rustc_hir = { path = "../rustc_hir" }
1716
rustc_lexer = { path = "../rustc_lexer" }
1817
rustc_macros = { path = "../rustc_macros" }
19-
rustc_middle = { path = "../rustc_middle" }
20-
rustc_serialize = { path = "../rustc_serialize" }
2118
rustc_session = { path = "../rustc_session" }
2219
rustc_span = { path = "../rustc_span" }
2320
thin-vec = "0.2.12"

compiler/rustc_codegen_ssa/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@ regex = "1.4"
1919
rustc_abi = { path = "../rustc_abi" }
2020
rustc_arena = { path = "../rustc_arena" }
2121
rustc_ast = { path = "../rustc_ast" }
22-
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
2322
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
2423
rustc_data_structures = { path = "../rustc_data_structures" }
2524
rustc_errors = { path = "../rustc_errors" }
2625
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
2726
rustc_fs_util = { path = "../rustc_fs_util" }
2827
rustc_hashes = { path = "../rustc_hashes" }
2928
rustc_hir = { path = "../rustc_hir" }
30-
rustc_hir_pretty = { path = "../rustc_hir_pretty" }
3129
rustc_incremental = { path = "../rustc_incremental" }
3230
rustc_index = { path = "../rustc_index" }
3331
rustc_macros = { path = "../rustc_macros" }

compiler/rustc_driver_impl/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ use rustc_errors::emitter::stderr_destination;
4444
use rustc_errors::registry::Registry;
4545
use rustc_errors::{ColorConfig, DiagCtxt, ErrCode, FatalError, PResult, markdown};
4646
use rustc_feature::find_gated_cfg;
47+
// This avoids a false positive with `-Wunused_crate_dependencies`.
48+
// `rust_index` isn't used in this crate's code, but it must be named in the
49+
// `Cargo.toml` for the `rustc_randomized_layouts` feature.
50+
use rustc_index as _;
4751
use rustc_interface::util::{self, get_codegen_backend};
4852
use rustc_interface::{Linker, create_and_enter_global_ctxt, interface, passes};
4953
use rustc_lint::unerased_lint_store;

compiler/rustc_interface/Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ edition = "2024"
77
# tidy-alphabetical-start
88
rustc-rayon = { version = "0.5.0" }
99
rustc-rayon-core = { version = "0.5.0" }
10-
rustc_abi = { path = "../rustc_abi" }
1110
rustc_ast = { path = "../rustc_ast" }
1211
rustc_ast_lowering = { path = "../rustc_ast_lowering" }
1312
rustc_ast_passes = { path = "../rustc_ast_passes" }
@@ -41,7 +40,6 @@ rustc_privacy = { path = "../rustc_privacy" }
4140
rustc_query_impl = { path = "../rustc_query_impl" }
4241
rustc_query_system = { path = "../rustc_query_system" }
4342
rustc_resolve = { path = "../rustc_resolve" }
44-
rustc_serialize = { path = "../rustc_serialize" }
4543
rustc_session = { path = "../rustc_session" }
4644
rustc_span = { path = "../rustc_span" }
4745
rustc_symbol_mangling = { path = "../rustc_symbol_mangling" }
@@ -52,6 +50,11 @@ rustc_ty_utils = { path = "../rustc_ty_utils" }
5250
tracing = "0.1"
5351
# tidy-alphabetical-end
5452

53+
[dev-dependencies]
54+
# tidy-alphabetical-start
55+
rustc_abi = { path = "../rustc_abi" }
56+
# tidy-alphabetical-end
57+
5558
[features]
5659
# tidy-alphabetical-start
5760
llvm = ['dep:rustc_codegen_llvm']

compiler/rustc_log/Cargo.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ tracing-subscriber = { version = "0.3.3", default-features = false, features = [
1111
tracing-tree = "0.3.1"
1212
# tidy-alphabetical-end
1313

14-
[dev-dependencies]
15-
# tidy-alphabetical-start
16-
rustc_span = { path = "../rustc_span" }
17-
# tidy-alphabetical-end
18-
1914
[features]
2015
# tidy-alphabetical-start
2116
max_level_info = ['tracing/max_level_info']

compiler/rustc_log/src/lib.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,12 @@
99
//! [dependencies]
1010
//! rustc_ast = { path = "../rust/compiler/rustc_ast" }
1111
//! rustc_log = { path = "../rust/compiler/rustc_log" }
12-
//! rustc_span = { path = "../rust/compiler/rustc_span" }
1312
//! ```
1413
//!
1514
//! ```
1615
//! fn main() {
1716
//! rustc_log::init_logger(rustc_log::LoggerConfig::from_env("LOG")).unwrap();
18-
//!
19-
//! let edition = rustc_span::edition::Edition::Edition2021;
20-
//! rustc_span::create_session_globals_then(edition, None, || {
21-
//! /* ... */
22-
//! });
17+
//! /* ... */
2318
//! }
2419
//! ```
2520
//!

compiler/rustc_metadata/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ edition = "2024"
66
[dependencies]
77
# tidy-alphabetical-start
88
bitflags = "2.4.1"
9-
libc = "0.2"
109
libloading = "0.8.0"
1110
odht = { version = "0.3.1", features = ["nightly"] }
1211
rustc_abi = { path = "../rustc_abi" }
@@ -31,3 +30,8 @@ rustc_type_ir = { path = "../rustc_type_ir" }
3130
tempfile = "3.2"
3231
tracing = "0.1"
3332
# tidy-alphabetical-end
33+
34+
[target.'cfg(target_os = "aix")'.dependencies]
35+
# tidy-alphabetical-start
36+
libc = "0.2"
37+
# tidy-alphabetical-end

0 commit comments

Comments
 (0)