Skip to content

Commit 00d9c5d

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`. 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 75530e9 commit 00d9c5d

File tree

26 files changed

+37
-48
lines changed

26 files changed

+37
-48
lines changed

Cargo.lock

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3204,7 +3204,6 @@ dependencies = [
32043204
"rustc_ast_ir",
32053205
"rustc_data_structures",
32063206
"rustc_index",
3207-
"rustc_lexer",
32083207
"rustc_macros",
32093208
"rustc_serialize",
32103209
"rustc_span",
@@ -3220,7 +3219,6 @@ dependencies = [
32203219
"rustc_data_structures",
32213220
"rustc_macros",
32223221
"rustc_serialize",
3223-
"rustc_span",
32243222
]
32253223

32263224
[[package]]
@@ -3239,7 +3237,6 @@ dependencies = [
32393237
"rustc_index",
32403238
"rustc_macros",
32413239
"rustc_middle",
3242-
"rustc_parse",
32433240
"rustc_session",
32443241
"rustc_span",
32453242
"rustc_target",
@@ -3274,7 +3271,6 @@ version = "0.0.0"
32743271
dependencies = [
32753272
"itertools",
32763273
"rustc_ast",
3277-
"rustc_data_structures",
32783274
"rustc_lexer",
32793275
"rustc_span",
32803276
"thin-vec",
@@ -3302,15 +3298,12 @@ dependencies = [
33023298
"rustc_ast",
33033299
"rustc_ast_pretty",
33043300
"rustc_attr_data_structures",
3305-
"rustc_data_structures",
33063301
"rustc_errors",
33073302
"rustc_feature",
33083303
"rustc_fluent_macro",
33093304
"rustc_hir",
33103305
"rustc_lexer",
33113306
"rustc_macros",
3312-
"rustc_middle",
3313-
"rustc_serialize",
33143307
"rustc_session",
33153308
"rustc_span",
33163309
"thin-vec",
@@ -3437,15 +3430,13 @@ dependencies = [
34373430
"rustc_abi",
34383431
"rustc_arena",
34393432
"rustc_ast",
3440-
"rustc_ast_pretty",
34413433
"rustc_attr_parsing",
34423434
"rustc_data_structures",
34433435
"rustc_errors",
34443436
"rustc_fluent_macro",
34453437
"rustc_fs_util",
34463438
"rustc_hashes",
34473439
"rustc_hir",
3448-
"rustc_hir_pretty",
34493440
"rustc_incremental",
34503441
"rustc_index",
34513442
"rustc_macros",
@@ -3893,7 +3884,6 @@ dependencies = [
38933884
"rustc_query_impl",
38943885
"rustc_query_system",
38953886
"rustc_resolve",
3896-
"rustc_serialize",
38973887
"rustc_session",
38983888
"rustc_span",
38993889
"rustc_symbol_mangling",
@@ -3969,7 +3959,6 @@ dependencies = [
39693959
name = "rustc_log"
39703960
version = "0.0.0"
39713961
dependencies = [
3972-
"rustc_span",
39733962
"tracing",
39743963
"tracing-core",
39753964
"tracing-subscriber",
@@ -4058,13 +4047,11 @@ dependencies = [
40584047
name = "rustc_mir_build"
40594048
version = "0.0.0"
40604049
dependencies = [
4061-
"either",
40624050
"itertools",
40634051
"rustc_abi",
40644052
"rustc_apfloat",
40654053
"rustc_arena",
40664054
"rustc_ast",
4067-
"rustc_attr_parsing",
40684055
"rustc_data_structures",
40694056
"rustc_errors",
40704057
"rustc_fluent_macro",
@@ -4345,7 +4332,6 @@ version = "0.0.0"
43454332
dependencies = [
43464333
"bitflags",
43474334
"rustc_abi",
4348-
"rustc_ast",
43494335
"rustc_data_structures",
43504336
"rustc_hir",
43514337
"rustc_middle",
@@ -4400,7 +4386,6 @@ name = "rustc_smir"
44004386
version = "0.0.0"
44014387
dependencies = [
44024388
"rustc_abi",
4403-
"rustc_ast",
44044389
"rustc_data_structures",
44054390
"rustc_hir",
44064391
"rustc_hir_pretty",
@@ -4442,7 +4427,6 @@ dependencies = [
44424427
"punycode",
44434428
"rustc-demangle",
44444429
"rustc_abi",
4445-
"rustc_ast",
44464430
"rustc_data_structures",
44474431
"rustc_errors",
44484432
"rustc_hashes",
@@ -4537,7 +4521,6 @@ version = "0.0.0"
45374521
dependencies = [
45384522
"itertools",
45394523
"rustc_abi",
4540-
"rustc_attr_parsing",
45414524
"rustc_data_structures",
45424525
"rustc_errors",
45434526
"rustc_fluent_macro",

compiler/rustc_ast/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ memchr = "2.7.4"
1111
rustc_ast_ir = { path = "../rustc_ast_ir" }
1212
rustc_data_structures = { path = "../rustc_data_structures" }
1313
rustc_index = { path = "../rustc_index" }
14-
rustc_lexer = { path = "../rustc_lexer" }
1514
rustc_macros = { path = "../rustc_macros" }
1615
rustc_serialize = { path = "../rustc_serialize" }
1716
rustc_span = { path = "../rustc_span" }

compiler/rustc_ast_ir/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ edition = "2024"
88
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
99
rustc_macros = { path = "../rustc_macros", optional = true }
1010
rustc_serialize = { path = "../rustc_serialize", optional = true }
11-
rustc_span = { path = "../rustc_span", optional = true }
1211
# tidy-alphabetical-end
1312

1413
[features]
@@ -17,5 +16,4 @@ nightly = [
1716
"dep:rustc_serialize",
1817
"dep:rustc_data_structures",
1918
"dep:rustc_macros",
20-
"dep:rustc_span",
2119
]

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']

0 commit comments

Comments
 (0)