Skip to content

Commit 4e2b096

Browse files
committed
Auto merge of rust-lang#137930 - nnethercote:use-Wunused-crate-dependencies, r=jieyouxu,Nadrieril
Use `Wunused-crate-dependencies` for the compiler An implementation of rust-lang/compiler-team#844. r? `@jieyouxu`
2 parents 70237a8 + e2320b3 commit 4e2b096

File tree

30 files changed

+51
-60
lines changed

30 files changed

+51
-60
lines changed

Cargo.lock

-19
Original file line numberDiff line numberDiff line change
@@ -3206,7 +3206,6 @@ dependencies = [
32063206
"rustc_data_structures",
32073207
"rustc_macros",
32083208
"rustc_serialize",
3209-
"rustc_span",
32103209
]
32113210

32123211
[[package]]
@@ -3225,7 +3224,6 @@ dependencies = [
32253224
"rustc_index",
32263225
"rustc_macros",
32273226
"rustc_middle",
3228-
"rustc_parse",
32293227
"rustc_session",
32303228
"rustc_span",
32313229
"rustc_target",
@@ -3260,7 +3258,6 @@ version = "0.0.0"
32603258
dependencies = [
32613259
"itertools",
32623260
"rustc_ast",
3263-
"rustc_data_structures",
32643261
"rustc_lexer",
32653262
"rustc_span",
32663263
"thin-vec",
@@ -3288,15 +3285,12 @@ dependencies = [
32883285
"rustc_ast",
32893286
"rustc_ast_pretty",
32903287
"rustc_attr_data_structures",
3291-
"rustc_data_structures",
32923288
"rustc_errors",
32933289
"rustc_feature",
32943290
"rustc_fluent_macro",
32953291
"rustc_hir",
32963292
"rustc_lexer",
32973293
"rustc_macros",
3298-
"rustc_middle",
3299-
"rustc_serialize",
33003294
"rustc_session",
33013295
"rustc_span",
33023296
"thin-vec",
@@ -3423,15 +3417,13 @@ dependencies = [
34233417
"rustc_abi",
34243418
"rustc_arena",
34253419
"rustc_ast",
3426-
"rustc_ast_pretty",
34273420
"rustc_attr_parsing",
34283421
"rustc_data_structures",
34293422
"rustc_errors",
34303423
"rustc_fluent_macro",
34313424
"rustc_fs_util",
34323425
"rustc_hashes",
34333426
"rustc_hir",
3434-
"rustc_hir_pretty",
34353427
"rustc_incremental",
34363428
"rustc_index",
34373429
"rustc_macros",
@@ -3879,7 +3871,6 @@ dependencies = [
38793871
"rustc_query_impl",
38803872
"rustc_query_system",
38813873
"rustc_resolve",
3882-
"rustc_serialize",
38833874
"rustc_session",
38843875
"rustc_span",
38853876
"rustc_symbol_mangling",
@@ -3954,7 +3945,6 @@ dependencies = [
39543945
name = "rustc_log"
39553946
version = "0.0.0"
39563947
dependencies = [
3957-
"rustc_span",
39583948
"tracing",
39593949
"tracing-core",
39603950
"tracing-subscriber",
@@ -4043,13 +4033,11 @@ dependencies = [
40434033
name = "rustc_mir_build"
40444034
version = "0.0.0"
40454035
dependencies = [
4046-
"either",
40474036
"itertools",
40484037
"rustc_abi",
40494038
"rustc_apfloat",
40504039
"rustc_arena",
40514040
"rustc_ast",
4052-
"rustc_attr_parsing",
40534041
"rustc_data_structures",
40544042
"rustc_errors",
40554043
"rustc_fluent_macro",
@@ -4256,7 +4244,6 @@ version = "0.0.0"
42564244
dependencies = [
42574245
"measureme 12.0.1",
42584246
"rustc_data_structures",
4259-
"rustc_errors",
42604247
"rustc_hashes",
42614248
"rustc_hir",
42624249
"rustc_index",
@@ -4265,7 +4252,6 @@ dependencies = [
42654252
"rustc_serialize",
42664253
"rustc_session",
42674254
"rustc_span",
4268-
"thin-vec",
42694255
"tracing",
42704256
]
42714257

@@ -4290,7 +4276,6 @@ dependencies = [
42904276
"rustc_session",
42914277
"rustc_span",
42924278
"smallvec",
4293-
"thin-vec",
42944279
"tracing",
42954280
]
42964281

@@ -4328,7 +4313,6 @@ version = "0.0.0"
43284313
dependencies = [
43294314
"bitflags",
43304315
"rustc_abi",
4331-
"rustc_ast",
43324316
"rustc_data_structures",
43334317
"rustc_hir",
43344318
"rustc_middle",
@@ -4383,7 +4367,6 @@ name = "rustc_smir"
43834367
version = "0.0.0"
43844368
dependencies = [
43854369
"rustc_abi",
4386-
"rustc_ast",
43874370
"rustc_data_structures",
43884371
"rustc_hir",
43894372
"rustc_hir_pretty",
@@ -4425,7 +4408,6 @@ dependencies = [
44254408
"punycode",
44264409
"rustc-demangle",
44274410
"rustc_abi",
4428-
"rustc_ast",
44294411
"rustc_data_structures",
44304412
"rustc_errors",
44314413
"rustc_hashes",
@@ -4520,7 +4502,6 @@ version = "0.0.0"
45204502
dependencies = [
45214503
"itertools",
45224504
"rustc_abi",
4523-
"rustc_attr_parsing",
45244505
"rustc_data_structures",
45254506
"rustc_errors",
45264507
"rustc_fluent_macro",

compiler/rustc_ast_ir/Cargo.toml

-2
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

-1
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

+4-1
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

-3
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

-2
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/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ time = { version = "0.3.36", default-features = false, features = ["alloc", "for
5454
tracing = { version = "0.1.35" }
5555
# tidy-alphabetical-end
5656

57-
[target.'cfg(unix)'.dependencies]
57+
[target.'cfg(all(unix, any(target_env = "gnu", target_os = "macos")))'.dependencies]
5858
# tidy-alphabetical-start
5959
libc = "0.2"
6060
# tidy-alphabetical-end

compiler/rustc_driver_impl/src/lib.rs

+8
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;
@@ -89,6 +93,10 @@ pub mod pretty;
8993
#[macro_use]
9094
mod print;
9195
mod session_diagnostics;
96+
97+
// Keep the OS parts of this `cfg` in sync with the `cfg` on the `libc`
98+
// dependency in `compiler/rustc_driver/Cargo.toml`, to keep
99+
// `-Wunused-crated-dependencies` satisfied.
92100
#[cfg(all(not(miri), unix, any(target_env = "gnu", target_os = "macos")))]
93101
mod signal_handler;
94102

compiler/rustc_interface/Cargo.toml

+5-2
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

-5
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

+1-6
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

+5-1
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" }
@@ -30,3 +29,8 @@ rustc_target = { path = "../rustc_target" }
3029
tempfile = "3.2"
3130
tracing = "0.1"
3231
# tidy-alphabetical-end
32+
33+
[target.'cfg(target_os = "aix")'.dependencies]
34+
# tidy-alphabetical-start
35+
libc = "0.2"
36+
# tidy-alphabetical-end

compiler/rustc_mir_build/Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@ edition = "2024"
55

66
[dependencies]
77
# tidy-alphabetical-start
8-
either = "1.5.0"
98
itertools = "0.12"
109

1110
rustc_abi = { path = "../rustc_abi" }
1211
rustc_apfloat = "0.2.0"
1312
rustc_arena = { path = "../rustc_arena" }
1413
rustc_ast = { path = "../rustc_ast" }
15-
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
1614
rustc_data_structures = { path = "../rustc_data_structures" }
1715
rustc_errors = { path = "../rustc_errors" }
1816
rustc_fluent_macro = { path = "../rustc_fluent_macro" }

compiler/rustc_parse_format/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ edition = "2024"
55

66
[dependencies]
77
# tidy-alphabetical-start
8-
rustc_index = { path = "../rustc_index", default-features = false }
98
rustc_lexer = { path = "../rustc_lexer" }
109
# tidy-alphabetical-end
10+
11+
[target.'cfg(target_pointer_width = "64")'.dependencies]
12+
rustc_index = { path = "../rustc_index", default-features = false }

compiler/rustc_pattern_analysis/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// tidy-alphabetical-start
66
#![allow(rustc::diagnostic_outside_of_impl)]
77
#![allow(rustc::untranslatable_diagnostic)]
8+
#![allow(unused_crate_dependencies)]
89
#![cfg_attr(feature = "rustc", feature(let_chains))]
910
// tidy-alphabetical-end
1011

compiler/rustc_pattern_analysis/tests/complexity.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! Test the pattern complexity limit.
22
3+
#![allow(unused_crate_dependencies)]
4+
35
use common::*;
46
use rustc_pattern_analysis::MatchArm;
57
use rustc_pattern_analysis::pat::DeconstructedPat;

compiler/rustc_pattern_analysis/tests/exhaustiveness.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! Test exhaustiveness checking.
22
3+
#![allow(unused_crate_dependencies)]
4+
35
use common::*;
46
use rustc_pattern_analysis::MatchArm;
57
use rustc_pattern_analysis::pat::{DeconstructedPat, WitnessPat};

compiler/rustc_pattern_analysis/tests/intersection.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! Test the computation of arm intersections.
22
3+
#![allow(unused_crate_dependencies)]
4+
35
use common::*;
46
use rustc_pattern_analysis::MatchArm;
57
use rustc_pattern_analysis::pat::DeconstructedPat;

compiler/rustc_query_impl/Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ edition = "2024"
77
# tidy-alphabetical-start
88
measureme = "12.0.1"
99
rustc_data_structures = { path = "../rustc_data_structures" }
10-
rustc_errors = { path = "../rustc_errors" }
1110
rustc_hashes = { path = "../rustc_hashes" }
1211
rustc_hir = { path = "../rustc_hir" }
1312
rustc_index = { path = "../rustc_index" }
@@ -16,6 +15,5 @@ rustc_query_system = { path = "../rustc_query_system" }
1615
rustc_serialize = { path = "../rustc_serialize" }
1716
rustc_session = { path = "../rustc_session" }
1817
rustc_span = { path = "../rustc_span" }
19-
thin-vec = "0.2.12"
2018
tracing = "0.1"
2119
# tidy-alphabetical-end

compiler/rustc_query_system/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,5 @@ rustc_serialize = { path = "../rustc_serialize" }
2222
rustc_session = { path = "../rustc_session" }
2323
rustc_span = { path = "../rustc_span" }
2424
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
25-
thin-vec = "0.2.12"
2625
tracing = "0.1"
2726
# tidy-alphabetical-end

0 commit comments

Comments
 (0)