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.
This commit is contained in:
parent
1aeb99d248
commit
8121958fda
28 changed files with 42 additions and 53 deletions
19
Cargo.lock
19
Cargo.lock
|
@ -3206,7 +3206,6 @@ dependencies = [
|
|||
"rustc_data_structures",
|
||||
"rustc_macros",
|
||||
"rustc_serialize",
|
||||
"rustc_span",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3225,7 +3224,6 @@ dependencies = [
|
|||
"rustc_index",
|
||||
"rustc_macros",
|
||||
"rustc_middle",
|
||||
"rustc_parse",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"rustc_target",
|
||||
|
@ -3260,7 +3258,6 @@ version = "0.0.0"
|
|||
dependencies = [
|
||||
"itertools",
|
||||
"rustc_ast",
|
||||
"rustc_data_structures",
|
||||
"rustc_lexer",
|
||||
"rustc_span",
|
||||
"thin-vec",
|
||||
|
@ -3288,15 +3285,12 @@ dependencies = [
|
|||
"rustc_ast",
|
||||
"rustc_ast_pretty",
|
||||
"rustc_attr_data_structures",
|
||||
"rustc_data_structures",
|
||||
"rustc_errors",
|
||||
"rustc_feature",
|
||||
"rustc_fluent_macro",
|
||||
"rustc_hir",
|
||||
"rustc_lexer",
|
||||
"rustc_macros",
|
||||
"rustc_middle",
|
||||
"rustc_serialize",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"thin-vec",
|
||||
|
@ -3423,7 +3417,6 @@ dependencies = [
|
|||
"rustc_abi",
|
||||
"rustc_arena",
|
||||
"rustc_ast",
|
||||
"rustc_ast_pretty",
|
||||
"rustc_attr_parsing",
|
||||
"rustc_data_structures",
|
||||
"rustc_errors",
|
||||
|
@ -3431,7 +3424,6 @@ dependencies = [
|
|||
"rustc_fs_util",
|
||||
"rustc_hashes",
|
||||
"rustc_hir",
|
||||
"rustc_hir_pretty",
|
||||
"rustc_incremental",
|
||||
"rustc_index",
|
||||
"rustc_macros",
|
||||
|
@ -3879,7 +3871,6 @@ dependencies = [
|
|||
"rustc_query_impl",
|
||||
"rustc_query_system",
|
||||
"rustc_resolve",
|
||||
"rustc_serialize",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"rustc_symbol_mangling",
|
||||
|
@ -3954,7 +3945,6 @@ dependencies = [
|
|||
name = "rustc_log"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"rustc_span",
|
||||
"tracing",
|
||||
"tracing-core",
|
||||
"tracing-subscriber",
|
||||
|
@ -4043,13 +4033,11 @@ dependencies = [
|
|||
name = "rustc_mir_build"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"either",
|
||||
"itertools",
|
||||
"rustc_abi",
|
||||
"rustc_apfloat",
|
||||
"rustc_arena",
|
||||
"rustc_ast",
|
||||
"rustc_attr_parsing",
|
||||
"rustc_data_structures",
|
||||
"rustc_errors",
|
||||
"rustc_fluent_macro",
|
||||
|
@ -4256,7 +4244,6 @@ version = "0.0.0"
|
|||
dependencies = [
|
||||
"measureme 12.0.1",
|
||||
"rustc_data_structures",
|
||||
"rustc_errors",
|
||||
"rustc_hashes",
|
||||
"rustc_hir",
|
||||
"rustc_index",
|
||||
|
@ -4265,7 +4252,6 @@ dependencies = [
|
|||
"rustc_serialize",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"thin-vec",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
|
@ -4290,7 +4276,6 @@ dependencies = [
|
|||
"rustc_session",
|
||||
"rustc_span",
|
||||
"smallvec",
|
||||
"thin-vec",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
|
@ -4328,7 +4313,6 @@ version = "0.0.0"
|
|||
dependencies = [
|
||||
"bitflags",
|
||||
"rustc_abi",
|
||||
"rustc_ast",
|
||||
"rustc_data_structures",
|
||||
"rustc_hir",
|
||||
"rustc_middle",
|
||||
|
@ -4383,7 +4367,6 @@ name = "rustc_smir"
|
|||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"rustc_abi",
|
||||
"rustc_ast",
|
||||
"rustc_data_structures",
|
||||
"rustc_hir",
|
||||
"rustc_hir_pretty",
|
||||
|
@ -4425,7 +4408,6 @@ dependencies = [
|
|||
"punycode",
|
||||
"rustc-demangle",
|
||||
"rustc_abi",
|
||||
"rustc_ast",
|
||||
"rustc_data_structures",
|
||||
"rustc_errors",
|
||||
"rustc_hashes",
|
||||
|
@ -4520,7 +4502,6 @@ version = "0.0.0"
|
|||
dependencies = [
|
||||
"itertools",
|
||||
"rustc_abi",
|
||||
"rustc_attr_parsing",
|
||||
"rustc_data_structures",
|
||||
"rustc_errors",
|
||||
"rustc_fluent_macro",
|
||||
|
|
|
@ -8,7 +8,6 @@ edition = "2024"
|
|||
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
|
||||
rustc_macros = { path = "../rustc_macros", optional = true }
|
||||
rustc_serialize = { path = "../rustc_serialize", optional = true }
|
||||
rustc_span = { path = "../rustc_span", optional = true }
|
||||
# tidy-alphabetical-end
|
||||
|
||||
[features]
|
||||
|
@ -17,5 +16,4 @@ nightly = [
|
|||
"dep:rustc_serialize",
|
||||
"dep:rustc_data_structures",
|
||||
"dep:rustc_macros",
|
||||
"dep:rustc_span",
|
||||
]
|
||||
|
|
|
@ -20,7 +20,6 @@ rustc_hir = { path = "../rustc_hir" }
|
|||
rustc_index = { path = "../rustc_index" }
|
||||
rustc_macros = { path = "../rustc_macros" }
|
||||
rustc_middle = { path = "../rustc_middle" }
|
||||
rustc_parse = { path = "../rustc_parse" }
|
||||
rustc_session = { path = "../rustc_session" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
rustc_target = { path = "../rustc_target" }
|
||||
|
|
|
@ -7,8 +7,11 @@ edition = "2024"
|
|||
# tidy-alphabetical-start
|
||||
itertools = "0.12"
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
rustc_lexer = { path = "../rustc_lexer" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
# tidy-alphabetical-end
|
||||
|
||||
[dev-dependencies]
|
||||
# tidy-alphabetical-start
|
||||
thin-vec = "0.2.12"
|
||||
# tidy-alphabetical-end
|
||||
|
|
|
@ -9,15 +9,12 @@ rustc_abi = { path = "../rustc_abi" }
|
|||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
|
||||
rustc_attr_data_structures = { path = "../rustc_attr_data_structures" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
rustc_errors = { path = "../rustc_errors" }
|
||||
rustc_feature = { path = "../rustc_feature" }
|
||||
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
|
||||
rustc_hir = { path = "../rustc_hir" }
|
||||
rustc_lexer = { path = "../rustc_lexer" }
|
||||
rustc_macros = { path = "../rustc_macros" }
|
||||
rustc_middle = { path = "../rustc_middle" }
|
||||
rustc_serialize = { path = "../rustc_serialize" }
|
||||
rustc_session = { path = "../rustc_session" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
thin-vec = "0.2.12"
|
||||
|
|
|
@ -19,7 +19,6 @@ regex = "1.4"
|
|||
rustc_abi = { path = "../rustc_abi" }
|
||||
rustc_arena = { path = "../rustc_arena" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
|
||||
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
rustc_errors = { path = "../rustc_errors" }
|
||||
|
@ -27,7 +26,6 @@ rustc_fluent_macro = { path = "../rustc_fluent_macro" }
|
|||
rustc_fs_util = { path = "../rustc_fs_util" }
|
||||
rustc_hashes = { path = "../rustc_hashes" }
|
||||
rustc_hir = { path = "../rustc_hir" }
|
||||
rustc_hir_pretty = { path = "../rustc_hir_pretty" }
|
||||
rustc_incremental = { path = "../rustc_incremental" }
|
||||
rustc_index = { path = "../rustc_index" }
|
||||
rustc_macros = { path = "../rustc_macros" }
|
||||
|
|
|
@ -54,7 +54,7 @@ time = { version = "0.3.36", default-features = false, features = ["alloc", "for
|
|||
tracing = { version = "0.1.35" }
|
||||
# tidy-alphabetical-end
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
[target.'cfg(all(unix, any(target_env = "gnu", target_os = "macos")))'.dependencies]
|
||||
# tidy-alphabetical-start
|
||||
libc = "0.2"
|
||||
# tidy-alphabetical-end
|
||||
|
|
|
@ -44,6 +44,10 @@ use rustc_errors::emitter::stderr_destination;
|
|||
use rustc_errors::registry::Registry;
|
||||
use rustc_errors::{ColorConfig, DiagCtxt, ErrCode, FatalError, PResult, markdown};
|
||||
use rustc_feature::find_gated_cfg;
|
||||
// This avoids a false positive with `-Wunused_crate_dependencies`.
|
||||
// `rust_index` isn't used in this crate's code, but it must be named in the
|
||||
// `Cargo.toml` for the `rustc_randomized_layouts` feature.
|
||||
use rustc_index as _;
|
||||
use rustc_interface::util::{self, get_codegen_backend};
|
||||
use rustc_interface::{Linker, create_and_enter_global_ctxt, interface, passes};
|
||||
use rustc_lint::unerased_lint_store;
|
||||
|
@ -89,6 +93,10 @@ pub mod pretty;
|
|||
#[macro_use]
|
||||
mod print;
|
||||
mod session_diagnostics;
|
||||
|
||||
// Keep the OS parts of this `cfg` in sync with the `cfg` on the `libc`
|
||||
// dependency in `compiler/rustc_driver/Cargo.toml`, to keep
|
||||
// `-Wunused-crated-dependencies` satisfied.
|
||||
#[cfg(all(not(miri), unix, any(target_env = "gnu", target_os = "macos")))]
|
||||
mod signal_handler;
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ edition = "2024"
|
|||
# tidy-alphabetical-start
|
||||
rustc-rayon = { version = "0.5.0" }
|
||||
rustc-rayon-core = { version = "0.5.0" }
|
||||
rustc_abi = { path = "../rustc_abi" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_ast_lowering = { path = "../rustc_ast_lowering" }
|
||||
rustc_ast_passes = { path = "../rustc_ast_passes" }
|
||||
|
@ -41,7 +40,6 @@ rustc_privacy = { path = "../rustc_privacy" }
|
|||
rustc_query_impl = { path = "../rustc_query_impl" }
|
||||
rustc_query_system = { path = "../rustc_query_system" }
|
||||
rustc_resolve = { path = "../rustc_resolve" }
|
||||
rustc_serialize = { path = "../rustc_serialize" }
|
||||
rustc_session = { path = "../rustc_session" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
rustc_symbol_mangling = { path = "../rustc_symbol_mangling" }
|
||||
|
@ -52,6 +50,11 @@ rustc_ty_utils = { path = "../rustc_ty_utils" }
|
|||
tracing = "0.1"
|
||||
# tidy-alphabetical-end
|
||||
|
||||
[dev-dependencies]
|
||||
# tidy-alphabetical-start
|
||||
rustc_abi = { path = "../rustc_abi" }
|
||||
# tidy-alphabetical-end
|
||||
|
||||
[features]
|
||||
# tidy-alphabetical-start
|
||||
llvm = ['dep:rustc_codegen_llvm']
|
||||
|
|
|
@ -11,11 +11,6 @@ tracing-subscriber = { version = "0.3.3", default-features = false, features = [
|
|||
tracing-tree = "0.3.1"
|
||||
# tidy-alphabetical-end
|
||||
|
||||
[dev-dependencies]
|
||||
# tidy-alphabetical-start
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
# tidy-alphabetical-end
|
||||
|
||||
[features]
|
||||
# tidy-alphabetical-start
|
||||
max_level_info = ['tracing/max_level_info']
|
||||
|
|
|
@ -9,17 +9,12 @@
|
|||
//! [dependencies]
|
||||
//! rustc_ast = { path = "../rust/compiler/rustc_ast" }
|
||||
//! rustc_log = { path = "../rust/compiler/rustc_log" }
|
||||
//! rustc_span = { path = "../rust/compiler/rustc_span" }
|
||||
//! ```
|
||||
//!
|
||||
//! ```
|
||||
//! fn main() {
|
||||
//! rustc_log::init_logger(rustc_log::LoggerConfig::from_env("LOG")).unwrap();
|
||||
//!
|
||||
//! let edition = rustc_span::edition::Edition::Edition2021;
|
||||
//! rustc_span::create_session_globals_then(edition, None, || {
|
||||
//! /* ... */
|
||||
//! });
|
||||
//! /* ... */
|
||||
//! }
|
||||
//! ```
|
||||
//!
|
||||
|
|
|
@ -6,7 +6,6 @@ edition = "2024"
|
|||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
bitflags = "2.4.1"
|
||||
libc = "0.2"
|
||||
libloading = "0.8.0"
|
||||
odht = { version = "0.3.1", features = ["nightly"] }
|
||||
rustc_abi = { path = "../rustc_abi" }
|
||||
|
@ -30,3 +29,8 @@ rustc_target = { path = "../rustc_target" }
|
|||
tempfile = "3.2"
|
||||
tracing = "0.1"
|
||||
# tidy-alphabetical-end
|
||||
|
||||
[target.'cfg(target_os = "aix")'.dependencies]
|
||||
# tidy-alphabetical-start
|
||||
libc = "0.2"
|
||||
# tidy-alphabetical-end
|
||||
|
|
|
@ -5,14 +5,12 @@ edition = "2024"
|
|||
|
||||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
either = "1.5.0"
|
||||
itertools = "0.12"
|
||||
|
||||
rustc_abi = { path = "../rustc_abi" }
|
||||
rustc_apfloat = "0.2.0"
|
||||
rustc_arena = { path = "../rustc_arena" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
rustc_errors = { path = "../rustc_errors" }
|
||||
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
|
||||
|
|
|
@ -5,6 +5,8 @@ edition = "2024"
|
|||
|
||||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
rustc_index = { path = "../rustc_index", default-features = false }
|
||||
rustc_lexer = { path = "../rustc_lexer" }
|
||||
# tidy-alphabetical-end
|
||||
|
||||
[target.'cfg(target_pointer_width = "64")'.dependencies]
|
||||
rustc_index = { path = "../rustc_index", default-features = false }
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
// tidy-alphabetical-start
|
||||
#![allow(rustc::diagnostic_outside_of_impl)]
|
||||
#![allow(rustc::untranslatable_diagnostic)]
|
||||
#![allow(unused_crate_dependencies)]
|
||||
#![cfg_attr(feature = "rustc", feature(let_chains))]
|
||||
// tidy-alphabetical-end
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
//! Test the pattern complexity limit.
|
||||
|
||||
#![allow(unused_crate_dependencies)]
|
||||
|
||||
use common::*;
|
||||
use rustc_pattern_analysis::MatchArm;
|
||||
use rustc_pattern_analysis::pat::DeconstructedPat;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
//! Test exhaustiveness checking.
|
||||
|
||||
#![allow(unused_crate_dependencies)]
|
||||
|
||||
use common::*;
|
||||
use rustc_pattern_analysis::MatchArm;
|
||||
use rustc_pattern_analysis::pat::{DeconstructedPat, WitnessPat};
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
//! Test the computation of arm intersections.
|
||||
|
||||
#![allow(unused_crate_dependencies)]
|
||||
|
||||
use common::*;
|
||||
use rustc_pattern_analysis::MatchArm;
|
||||
use rustc_pattern_analysis::pat::DeconstructedPat;
|
||||
|
|
|
@ -7,7 +7,6 @@ edition = "2024"
|
|||
# tidy-alphabetical-start
|
||||
measureme = "12.0.1"
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
rustc_errors = { path = "../rustc_errors" }
|
||||
rustc_hashes = { path = "../rustc_hashes" }
|
||||
rustc_hir = { path = "../rustc_hir" }
|
||||
rustc_index = { path = "../rustc_index" }
|
||||
|
@ -16,6 +15,5 @@ rustc_query_system = { path = "../rustc_query_system" }
|
|||
rustc_serialize = { path = "../rustc_serialize" }
|
||||
rustc_session = { path = "../rustc_session" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
thin-vec = "0.2.12"
|
||||
tracing = "0.1"
|
||||
# tidy-alphabetical-end
|
||||
|
|
|
@ -22,6 +22,5 @@ rustc_serialize = { path = "../rustc_serialize" }
|
|||
rustc_session = { path = "../rustc_session" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
|
||||
thin-vec = "0.2.12"
|
||||
tracing = "0.1"
|
||||
# tidy-alphabetical-end
|
||||
|
|
|
@ -8,7 +8,6 @@ bitflags = "2.5.0"
|
|||
tracing = "0.1"
|
||||
twox-hash = "1.6.3"
|
||||
rustc_abi = { path = "../rustc_abi" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
rustc_hir = { path = "../rustc_hir" }
|
||||
rustc_middle = { path = "../rustc_middle" }
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
// tidy-alphabetical-start
|
||||
#![allow(internal_features)]
|
||||
#![allow(rustc::internal)]
|
||||
// FIXME
|
||||
#![allow(unused_crate_dependencies)]
|
||||
#![cfg_attr(test, feature(test))]
|
||||
#![doc(
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// FIXME
|
||||
#![allow(unused_crate_dependencies)]
|
||||
|
||||
use rustc_serialize::Decoder;
|
||||
use rustc_serialize::leb128::*;
|
||||
use rustc_serialize::opaque::{MAGIC_END_BYTES, MemDecoder};
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#![allow(rustc::internal)]
|
||||
// FIXME
|
||||
#![allow(unused_crate_dependencies)]
|
||||
|
||||
use std::fmt::Debug;
|
||||
use std::fs;
|
||||
|
|
|
@ -6,7 +6,6 @@ edition = "2024"
|
|||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
rustc_abi = { path = "../rustc_abi" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
rustc_hir = { path = "../rustc_hir" }
|
||||
rustc_hir_pretty = { path = "../rustc_hir_pretty" }
|
||||
|
|
|
@ -9,7 +9,6 @@ punycode = "0.4.0"
|
|||
rustc-demangle = "0.1.21"
|
||||
|
||||
rustc_abi = { path = "../rustc_abi" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
rustc_errors = { path = "../rustc_errors" }
|
||||
rustc_hashes = { path = "../rustc_hashes" }
|
||||
|
|
|
@ -7,7 +7,6 @@ edition = "2024"
|
|||
# tidy-alphabetical-start
|
||||
itertools = "0.12"
|
||||
rustc_abi = { path = "../rustc_abi" }
|
||||
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
rustc_errors = { path = "../rustc_errors" }
|
||||
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
|
||||
|
|
|
@ -1073,6 +1073,7 @@ impl Builder<'_> {
|
|||
lint_flags.push("-Wkeyword_idents_2024");
|
||||
lint_flags.push("-Wunreachable_pub");
|
||||
lint_flags.push("-Wunsafe_op_in_unsafe_fn");
|
||||
lint_flags.push("-Wunused_crate_dependencies");
|
||||
}
|
||||
|
||||
// This does not use RUSTFLAGS for two reasons.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue