Skip to content

Commit 4c4501f

Browse files
committed
Use warn(unused_crate_dependencies) in compiler crates.
The commit also removes fifteen unnecessary dependencies from `Cargo.toml` files that this finds. And tweaks some conditional dependencies. There are three crates with false positives, relating to tests and doc comments. For these three crates `allow(unused_crate_dependencies)` is used along with an explanatory comment.
1 parent 7c4a55c commit 4c4501f

File tree

87 files changed

+110
-40
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+110
-40
lines changed

Cargo.lock

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3216,7 +3216,6 @@ dependencies = [
32163216
"rustc_index",
32173217
"rustc_macros",
32183218
"rustc_middle",
3219-
"rustc_parse",
32203219
"rustc_session",
32213220
"rustc_span",
32223221
"rustc_target",
@@ -3251,7 +3250,6 @@ version = "0.0.0"
32513250
dependencies = [
32523251
"itertools",
32533252
"rustc_ast",
3254-
"rustc_data_structures",
32553253
"rustc_lexer",
32563254
"rustc_span",
32573255
"thin-vec",
@@ -3279,14 +3277,12 @@ dependencies = [
32793277
"rustc_ast",
32803278
"rustc_ast_pretty",
32813279
"rustc_attr_data_structures",
3282-
"rustc_data_structures",
32833280
"rustc_errors",
32843281
"rustc_feature",
32853282
"rustc_fluent_macro",
32863283
"rustc_hir",
32873284
"rustc_lexer",
32883285
"rustc_macros",
3289-
"rustc_serialize",
32903286
"rustc_session",
32913287
"rustc_span",
32923288
"thin-vec",
@@ -3413,15 +3409,13 @@ dependencies = [
34133409
"rustc_abi",
34143410
"rustc_arena",
34153411
"rustc_ast",
3416-
"rustc_ast_pretty",
34173412
"rustc_attr_parsing",
34183413
"rustc_data_structures",
34193414
"rustc_errors",
34203415
"rustc_fluent_macro",
34213416
"rustc_fs_util",
34223417
"rustc_hashes",
34233418
"rustc_hir",
3424-
"rustc_hir_pretty",
34253419
"rustc_incremental",
34263420
"rustc_index",
34273421
"rustc_macros",
@@ -3536,7 +3530,6 @@ dependencies = [
35363530
"rustc_hir_pretty",
35373531
"rustc_hir_typeck",
35383532
"rustc_incremental",
3539-
"rustc_index",
35403533
"rustc_infer",
35413534
"rustc_interface",
35423535
"rustc_lint",
@@ -3872,7 +3865,6 @@ dependencies = [
38723865
"rustc_query_impl",
38733866
"rustc_query_system",
38743867
"rustc_resolve",
3875-
"rustc_serialize",
38763868
"rustc_session",
38773869
"rustc_span",
38783870
"rustc_symbol_mangling",
@@ -4037,13 +4029,11 @@ dependencies = [
40374029
name = "rustc_mir_build"
40384030
version = "0.0.0"
40394031
dependencies = [
4040-
"either",
40414032
"itertools",
40424033
"rustc_abi",
40434034
"rustc_apfloat",
40444035
"rustc_arena",
40454036
"rustc_ast",
4046-
"rustc_attr_parsing",
40474037
"rustc_data_structures",
40484038
"rustc_errors",
40494039
"rustc_fluent_macro",
@@ -4250,7 +4240,6 @@ name = "rustc_query_impl"
42504240
version = "0.0.0"
42514241
dependencies = [
42524242
"measureme",
4253-
"rustc_attr_data_structures",
42544243
"rustc_data_structures",
42554244
"rustc_errors",
42564245
"rustc_hashes",
@@ -4324,7 +4313,6 @@ version = "0.0.0"
43244313
dependencies = [
43254314
"bitflags",
43264315
"rustc_abi",
4327-
"rustc_ast",
43284316
"rustc_data_structures",
43294317
"rustc_hir",
43304318
"rustc_middle",
@@ -4379,7 +4367,6 @@ name = "rustc_smir"
43794367
version = "0.0.0"
43804368
dependencies = [
43814369
"rustc_abi",
4382-
"rustc_ast",
43834370
"rustc_data_structures",
43844371
"rustc_hir",
43854372
"rustc_hir_pretty",
@@ -4421,7 +4408,6 @@ dependencies = [
44214408
"punycode",
44224409
"rustc-demangle",
44234410
"rustc_abi",
4424-
"rustc_ast",
44254411
"rustc_data_structures",
44264412
"rustc_errors",
44274413
"rustc_hashes",

compiler/rustc_abi/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#![cfg_attr(feature = "nightly", feature(rustdoc_internals))]
77
#![cfg_attr(feature = "nightly", feature(step_trait))]
88
#![warn(unreachable_pub)]
9+
#![warn(unused_crate_dependencies)]
910
// tidy-alphabetical-end
1011

1112
/*! ABI handling for rustc

compiler/rustc_arena/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#![feature(rustc_attrs)]
2525
#![feature(rustdoc_internals)]
2626
#![warn(unreachable_pub)]
27+
#![warn(unused_crate_dependencies)]
2728
// tidy-alphabetical-end
2829

2930
use std::alloc::Layout;

compiler/rustc_ast/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#![feature(rustdoc_internals)]
2121
#![feature(stmt_expr_attributes)]
2222
#![warn(unreachable_pub)]
23+
#![warn(unused_crate_dependencies)]
2324
// tidy-alphabetical-end
2425

2526
pub mod util {

compiler/rustc_ast_ir/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#![cfg_attr(feature = "nightly", feature(never_type))]
1111
#![cfg_attr(feature = "nightly", feature(rustc_attrs))]
1212
#![warn(unreachable_pub)]
13+
#![warn(unused_crate_dependencies)]
1314
// tidy-alphabetical-end
1415

1516
#[cfg(feature = "nightly")]

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_lowering/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#![feature(let_chains)]
4040
#![feature(rustdoc_internals)]
4141
#![warn(unreachable_pub)]
42+
#![warn(unused_crate_dependencies)]
4243
// tidy-alphabetical-end
4344

4445
use std::sync::Arc;

compiler/rustc_ast_passes/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#![feature(let_chains)]
1212
#![feature(rustdoc_internals)]
1313
#![warn(unreachable_pub)]
14+
#![warn(unused_crate_dependencies)]
1415
// tidy-alphabetical-end
1516

1617
pub mod ast_validation;

compiler/rustc_ast_pretty/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ 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" }
1312
thin-vec = "0.2.12"

compiler/rustc_ast_pretty/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#![feature(box_patterns)]
55
#![feature(rustdoc_internals)]
66
#![warn(unreachable_pub)]
7+
#![warn(unused_crate_dependencies)]
78
// tidy-alphabetical-end
89

910
mod helpers;

0 commit comments

Comments
 (0)