Skip to content

Commit d65cd4f

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 d65cd4f

File tree

87 files changed

+109
-36
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

+109
-36
lines changed

Cargo.lock

Lines changed: 0 additions & 13 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",
@@ -3872,7 +3866,6 @@ dependencies = [
38723866
"rustc_query_impl",
38733867
"rustc_query_system",
38743868
"rustc_resolve",
3875-
"rustc_serialize",
38763869
"rustc_session",
38773870
"rustc_span",
38783871
"rustc_symbol_mangling",
@@ -4037,13 +4030,11 @@ dependencies = [
40374030
name = "rustc_mir_build"
40384031
version = "0.0.0"
40394032
dependencies = [
4040-
"either",
40414033
"itertools",
40424034
"rustc_abi",
40434035
"rustc_apfloat",
40444036
"rustc_arena",
40454037
"rustc_ast",
4046-
"rustc_attr_parsing",
40474038
"rustc_data_structures",
40484039
"rustc_errors",
40494040
"rustc_fluent_macro",
@@ -4250,7 +4241,6 @@ name = "rustc_query_impl"
42504241
version = "0.0.0"
42514242
dependencies = [
42524243
"measureme",
4253-
"rustc_attr_data_structures",
42544244
"rustc_data_structures",
42554245
"rustc_errors",
42564246
"rustc_hashes",
@@ -4324,7 +4314,6 @@ version = "0.0.0"
43244314
dependencies = [
43254315
"bitflags",
43264316
"rustc_abi",
4327-
"rustc_ast",
43284317
"rustc_data_structures",
43294318
"rustc_hir",
43304319
"rustc_middle",
@@ -4379,7 +4368,6 @@ name = "rustc_smir"
43794368
version = "0.0.0"
43804369
dependencies = [
43814370
"rustc_abi",
4382-
"rustc_ast",
43834371
"rustc_data_structures",
43844372
"rustc_hir",
43854373
"rustc_hir_pretty",
@@ -4421,7 +4409,6 @@ dependencies = [
44214409
"punycode",
44224410
"rustc-demangle",
44234411
"rustc_abi",
4424-
"rustc_ast",
44254412
"rustc_data_structures",
44264413
"rustc_errors",
44274414
"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)