diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-03-03 18:59:30 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-03-20 08:59:43 +1100 |
| commit | 8121958fda43759fa94e3f74f7cdbb595ddcc0e5 (patch) | |
| tree | c20bf9e69eff3c798349dd05b42ee8080af954f4 /compiler/rustc_driver_impl/src | |
| parent | 1aeb99d248e1b0069110cb03c6f1dcc7b36fd7f3 (diff) | |
| download | rust-8121958fda43759fa94e3f74f7cdbb595ddcc0e5.tar.gz rust-8121958fda43759fa94e3f74f7cdbb595ddcc0e5.zip | |
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.
Diffstat (limited to 'compiler/rustc_driver_impl/src')
| -rw-r--r-- | compiler/rustc_driver_impl/src/lib.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 43dc2e3cf9e..8ede6e41336 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -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; |
