diff --git a/Cargo.lock b/Cargo.lock index ba8b2c270059a..0603670af4b0f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4205,7 +4205,6 @@ dependencies = [ "rustc_middle", "rustc_span", "rustc_target", - "rustc_type_ir", "smallvec", "tracing", ] @@ -4323,7 +4322,6 @@ dependencies = [ name = "rustc_log" version = "0.0.0" dependencies = [ - "rustc_span", "tracing", "tracing-core", "tracing-subscriber", diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index b1a17d5a24b67..6382805e18396 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -2,6 +2,7 @@ #![cfg_attr(feature = "nightly", allow(internal_features))] #![cfg_attr(feature = "nightly", doc(rust_logo))] #![cfg_attr(feature = "nightly", feature(rustdoc_internals))] +#![deny(unused_crate_dependencies)] use std::fmt; use std::num::{NonZeroUsize, ParseIntError}; diff --git a/compiler/rustc_arena/src/lib.rs b/compiler/rustc_arena/src/lib.rs index bdbc59821de2f..03e4fd901c831 100644 --- a/compiler/rustc_arena/src/lib.rs +++ b/compiler/rustc_arena/src/lib.rs @@ -22,6 +22,7 @@ #![cfg_attr(test, feature(test))] #![feature(strict_provenance)] #![deny(unsafe_op_in_unsafe_fn)] +#![deny(unused_crate_dependencies)] #![allow(internal_features)] #![allow(clippy::mut_from_ref)] // Arena allocators are one of the places where this pattern is fine. diff --git a/compiler/rustc_ast/src/lib.rs b/compiler/rustc_ast/src/lib.rs index 63cde3c6809c6..898c38a8a4e71 100644 --- a/compiler/rustc_ast/src/lib.rs +++ b/compiler/rustc_ast/src/lib.rs @@ -10,6 +10,7 @@ )] #![doc(rust_logo)] #![allow(internal_features)] +#![deny(unused_crate_dependencies)] #![feature(rustdoc_internals)] #![feature(associated_type_defaults)] #![feature(box_patterns)] diff --git a/compiler/rustc_ast_ir/src/lib.rs b/compiler/rustc_ast_ir/src/lib.rs index b1a77639b5623..1c4a80953a547 100644 --- a/compiler/rustc_ast_ir/src/lib.rs +++ b/compiler/rustc_ast_ir/src/lib.rs @@ -1,6 +1,7 @@ #![cfg_attr(feature = "nightly", feature(never_type))] #![cfg_attr(feature = "nightly", feature(rustc_attrs))] #![cfg_attr(feature = "nightly", allow(internal_features))] +#![deny(unused_crate_dependencies)] #[cfg(feature = "nightly")] use rustc_macros::{Decodable, Encodable, HashStable_NoContext}; diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 1c6b5b9af1954..04616275ff807 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -31,6 +31,7 @@ //! in the HIR, especially for multiple identifiers. #![allow(internal_features)] +#![deny(unused_crate_dependencies)] #![feature(rustdoc_internals)] #![doc(rust_logo)] #![feature(assert_matches)] diff --git a/compiler/rustc_ast_passes/src/lib.rs b/compiler/rustc_ast_passes/src/lib.rs index 74d0fff2734fc..b90e5ec35085a 100644 --- a/compiler/rustc_ast_passes/src/lib.rs +++ b/compiler/rustc_ast_passes/src/lib.rs @@ -5,6 +5,7 @@ //! The crate also contains other misc AST visitors, e.g. `node_count` and `show_span`. #![allow(internal_features)] +#![deny(unused_crate_dependencies)] #![doc(rust_logo)] #![feature(rustdoc_internals)] #![feature(box_patterns)] diff --git a/compiler/rustc_ast_pretty/src/lib.rs b/compiler/rustc_ast_pretty/src/lib.rs index b9e217a21e39f..6a58ac6c7b42c 100644 --- a/compiler/rustc_ast_pretty/src/lib.rs +++ b/compiler/rustc_ast_pretty/src/lib.rs @@ -1,4 +1,5 @@ #![allow(internal_features)] +#![deny(unused_crate_dependencies)] #![feature(rustdoc_internals)] #![doc(rust_logo)] #![feature(box_patterns)] diff --git a/compiler/rustc_attr/src/lib.rs b/compiler/rustc_attr/src/lib.rs index c61b7ea6d8220..5552a8a6a3a39 100644 --- a/compiler/rustc_attr/src/lib.rs +++ b/compiler/rustc_attr/src/lib.rs @@ -5,6 +5,7 @@ //! to this crate. #![allow(internal_features)] +#![deny(unused_crate_dependencies)] #![feature(rustdoc_internals)] #![doc(rust_logo)] #![feature(let_chains)] diff --git a/compiler/rustc_baked_icu_data/src/lib.rs b/compiler/rustc_baked_icu_data/src/lib.rs index ffcb290685a19..fe6c5eec7600b 100644 --- a/compiler/rustc_baked_icu_data/src/lib.rs +++ b/compiler/rustc_baked_icu_data/src/lib.rs @@ -21,6 +21,7 @@ //! ``` #![allow(internal_features)] +#![deny(unused_crate_dependencies)] #![feature(rustdoc_internals)] #![doc(rust_logo)] #![allow(elided_lifetimes_in_paths)] diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index 1d5801467da89..29293324c98ed 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -1,6 +1,7 @@ //! This query borrow-checks the MIR to (further) ensure it is not broken. #![allow(internal_features)] +#![deny(unused_crate_dependencies)] #![feature(rustdoc_internals)] #![doc(rust_logo)] #![feature(assert_matches)] diff --git a/compiler/rustc_builtin_macros/src/lib.rs b/compiler/rustc_builtin_macros/src/lib.rs index 744c7f9d09006..396074fd6f2a5 100644 --- a/compiler/rustc_builtin_macros/src/lib.rs +++ b/compiler/rustc_builtin_macros/src/lib.rs @@ -4,6 +4,7 @@ #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] +#![deny(unused_crate_dependencies)] #![feature(rustdoc_internals)] #![doc(rust_logo)] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs index 0029ec9d09a25..c31e8042e9b59 100644 --- a/compiler/rustc_codegen_llvm/src/lib.rs +++ b/compiler/rustc_codegen_llvm/src/lib.rs @@ -5,6 +5,7 @@ //! This API is completely unstable and subject to change. #![allow(internal_features)] +#![deny(unused_crate_dependencies)] #![feature(rustdoc_internals)] #![doc(rust_logo)] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] diff --git a/compiler/rustc_codegen_ssa/src/lib.rs b/compiler/rustc_codegen_ssa/src/lib.rs index 3b1921d40e6ba..19afc7f47a541 100644 --- a/compiler/rustc_codegen_ssa/src/lib.rs +++ b/compiler/rustc_codegen_ssa/src/lib.rs @@ -4,6 +4,7 @@ #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] +#![deny(unused_crate_dependencies)] #![feature(box_patterns)] #![feature(if_let_guard)] #![feature(let_chains)] diff --git a/compiler/rustc_const_eval/src/lib.rs b/compiler/rustc_const_eval/src/lib.rs index 3a7c87c1cad94..d601a26c59b85 100644 --- a/compiler/rustc_const_eval/src/lib.rs +++ b/compiler/rustc_const_eval/src/lib.rs @@ -1,5 +1,6 @@ #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] +#![deny(unused_crate_dependencies)] #![feature(rustdoc_internals)] #![doc(rust_logo)] #![feature(assert_matches)] diff --git a/compiler/rustc_data_structures/src/lib.rs b/compiler/rustc_data_structures/src/lib.rs index 9781aae22eb3e..5b31e41d153e3 100644 --- a/compiler/rustc_data_structures/src/lib.rs +++ b/compiler/rustc_data_structures/src/lib.rs @@ -12,6 +12,7 @@ #![allow(rustc::potential_query_instability)] #![cfg_attr(not(parallel_compiler), feature(cell_leak))] #![deny(unsafe_op_in_unsafe_fn)] +#![deny(unused_crate_dependencies)] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(allocator_api)] diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs index acd93b0b2a60f..43f8ec4279248 100644 --- a/compiler/rustc_driver/src/lib.rs +++ b/compiler/rustc_driver/src/lib.rs @@ -2,6 +2,7 @@ // `rustc_driver_impl` to be compiled in parallel with other crates. #![allow(internal_features)] +#![deny(unused_crate_dependencies)] #![feature(rustdoc_internals)] #![doc(rust_logo)] diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 93a65290602af..b0b1a2d297542 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -9,6 +9,7 @@ #![doc(rust_logo)] #![feature(rustdoc_internals)] #![allow(internal_features)] +#![deny(unused_crate_dependencies)] #![feature(decl_macro)] #![feature(let_chains)] #![feature(panic_backtrace_config)] diff --git a/compiler/rustc_error_codes/src/lib.rs b/compiler/rustc_error_codes/src/lib.rs index f4a33a05c1b36..e7e85e2b95bab 100644 --- a/compiler/rustc_error_codes/src/lib.rs +++ b/compiler/rustc_error_codes/src/lib.rs @@ -5,6 +5,7 @@ #![feature(rustdoc_internals)] #![doc(rust_logo)] #![deny(rustdoc::invalid_codeblock_attributes)] +#![deny(unused_crate_dependencies)] // This higher-order macro defines the error codes that are in use. It is used // in the `rustc_errors` crate. Removed error codes are listed in the comment diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 4dc5d84b318bd..47d54d9377cfd 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -7,6 +7,7 @@ #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] +#![deny(unused_crate_dependencies)] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(array_windows)] diff --git a/compiler/rustc_expand/src/lib.rs b/compiler/rustc_expand/src/lib.rs index 4222c9fe90616..7be19eac917f2 100644 --- a/compiler/rustc_expand/src/lib.rs +++ b/compiler/rustc_expand/src/lib.rs @@ -1,6 +1,7 @@ // tidy-alphabetical-start #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] +#![deny(unused_crate_dependencies)] #![doc(rust_logo)] #![feature(array_windows)] #![feature(associated_type_defaults)] diff --git a/compiler/rustc_feature/src/lib.rs b/compiler/rustc_feature/src/lib.rs index 9db9073e2f02f..2758f2821ea57 100644 --- a/compiler/rustc_feature/src/lib.rs +++ b/compiler/rustc_feature/src/lib.rs @@ -12,6 +12,7 @@ //! symbol to the `accepted` or `removed` modules respectively. #![allow(internal_features)] +#![deny(unused_crate_dependencies)] #![feature(rustdoc_internals)] #![doc(rust_logo)] diff --git a/compiler/rustc_fluent_macro/src/lib.rs b/compiler/rustc_fluent_macro/src/lib.rs index 2303785f94e69..5b3090fcdd965 100644 --- a/compiler/rustc_fluent_macro/src/lib.rs +++ b/compiler/rustc_fluent_macro/src/lib.rs @@ -1,6 +1,7 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![allow(internal_features)] +#![deny(unused_crate_dependencies)] #![feature(rustdoc_internals)] #![feature(proc_macro_diagnostic)] #![feature(proc_macro_span)] diff --git a/compiler/rustc_fs_util/src/lib.rs b/compiler/rustc_fs_util/src/lib.rs index d376c24cb589c..d5d25b1258f6a 100644 --- a/compiler/rustc_fs_util/src/lib.rs +++ b/compiler/rustc_fs_util/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(unused_crate_dependencies)] + use std::ffi::CString; use std::fs; use std::io; diff --git a/compiler/rustc_graphviz/src/lib.rs b/compiler/rustc_graphviz/src/lib.rs index 43bee5c4be029..98d56e7bb191e 100644 --- a/compiler/rustc_graphviz/src/lib.rs +++ b/compiler/rustc_graphviz/src/lib.rs @@ -276,6 +276,7 @@ #![feature(rustdoc_internals)] #![doc(rust_logo)] #![allow(internal_features)] +#![deny(unused_crate_dependencies)] use LabelText::*; diff --git a/compiler/rustc_hir/src/lib.rs b/compiler/rustc_hir/src/lib.rs index 600a0dce03b94..fcdbb0d3aaa1a 100644 --- a/compiler/rustc_hir/src/lib.rs +++ b/compiler/rustc_hir/src/lib.rs @@ -9,6 +9,7 @@ #![feature(rustc_attrs)] #![feature(variant_count)] #![allow(internal_features)] +#![deny(unused_crate_dependencies)] extern crate self as rustc_hir; diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs index 8fe81851f9327..12b22fda32291 100644 --- a/compiler/rustc_hir_analysis/src/lib.rs +++ b/compiler/rustc_hir_analysis/src/lib.rs @@ -58,6 +58,7 @@ This API is completely unstable and subject to change. #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::potential_query_instability)] #![allow(rustc::untranslatable_diagnostic)] +#![deny(unused_crate_dependencies)] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(rustdoc_internals)] diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index 6f2febd86b0fc..6585024162774 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -1,6 +1,7 @@ //! HIR pretty-printing is layered on top of AST pretty-printing. A number of //! the definitions in this file have equivalents in `rustc_ast_pretty`. +#![deny(unused_crate_dependencies)] #![recursion_limit = "256"] use rustc_ast as ast; diff --git a/compiler/rustc_hir_typeck/src/lib.rs b/compiler/rustc_hir_typeck/src/lib.rs index 86fe2756b59a0..553643c143acb 100644 --- a/compiler/rustc_hir_typeck/src/lib.rs +++ b/compiler/rustc_hir_typeck/src/lib.rs @@ -1,5 +1,6 @@ #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] +#![deny(unused_crate_dependencies)] #![feature(if_let_guard)] #![feature(let_chains)] #![feature(try_blocks)] diff --git a/compiler/rustc_incremental/src/lib.rs b/compiler/rustc_incremental/src/lib.rs index 960a2d012e0fa..02bf1dfeaad44 100644 --- a/compiler/rustc_incremental/src/lib.rs +++ b/compiler/rustc_incremental/src/lib.rs @@ -1,6 +1,7 @@ //! Support for serializing the dep-graph and reloading it. #![deny(missing_docs)] +#![deny(unused_crate_dependencies)] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(rustdoc_internals)] diff --git a/compiler/rustc_index/src/lib.rs b/compiler/rustc_index/src/lib.rs index 6fcb3a024ab6f..4d3e717b560e7 100644 --- a/compiler/rustc_index/src/lib.rs +++ b/compiler/rustc_index/src/lib.rs @@ -4,6 +4,7 @@ )] #![cfg_attr(all(feature = "nightly", test), feature(stmt_expr_attributes))] #![cfg_attr(feature = "nightly", allow(internal_features))] +#![deny(unused_crate_dependencies)] pub mod bit_set; #[cfg(feature = "nightly")] diff --git a/compiler/rustc_index_macros/src/lib.rs b/compiler/rustc_index_macros/src/lib.rs index 015518ae4d688..496ef1a79b2a6 100644 --- a/compiler/rustc_index_macros/src/lib.rs +++ b/compiler/rustc_index_macros/src/lib.rs @@ -1,5 +1,6 @@ #![cfg_attr(feature = "nightly", feature(allow_internal_unstable))] #![cfg_attr(feature = "nightly", allow(internal_features))] +#![deny(unused_crate_dependencies)] use proc_macro::TokenStream; diff --git a/compiler/rustc_infer/Cargo.toml b/compiler/rustc_infer/Cargo.toml index 5136ab79a0f84..c1565a7d40fd5 100644 --- a/compiler/rustc_infer/Cargo.toml +++ b/compiler/rustc_infer/Cargo.toml @@ -18,7 +18,6 @@ rustc_macros = { path = "../rustc_macros" } rustc_middle = { path = "../rustc_middle" } rustc_span = { path = "../rustc_span" } rustc_target = { path = "../rustc_target" } -rustc_type_ir = { path = "../rustc_type_ir" } smallvec = { version = "1.8.1", features = ["union", "may_dangle"] } tracing = "0.1" # tidy-alphabetical-end diff --git a/compiler/rustc_infer/src/lib.rs b/compiler/rustc_infer/src/lib.rs index 28d908abf83ed..9bddf056bc779 100644 --- a/compiler/rustc_infer/src/lib.rs +++ b/compiler/rustc_infer/src/lib.rs @@ -18,6 +18,7 @@ #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] +#![deny(unused_crate_dependencies)] #![feature(box_patterns)] #![feature(control_flow_enum)] #![feature(extend_one)] diff --git a/compiler/rustc_interface/src/lib.rs b/compiler/rustc_interface/src/lib.rs index 8b1d9b706cacb..ad5dd60bedc26 100644 --- a/compiler/rustc_interface/src/lib.rs +++ b/compiler/rustc_interface/src/lib.rs @@ -1,3 +1,4 @@ +#![deny(unused_crate_dependencies)] #![feature(decl_macro)] #![feature(let_chains)] #![feature(thread_spawn_unchecked)] diff --git a/compiler/rustc_lexer/src/lib.rs b/compiler/rustc_lexer/src/lib.rs index 6f8a9792b6ce8..79aceff083a5b 100644 --- a/compiler/rustc_lexer/src/lib.rs +++ b/compiler/rustc_lexer/src/lib.rs @@ -22,6 +22,7 @@ // We want to be able to build this crate with a stable compiler, // so no `#![feature]` attributes should be added. #![deny(unstable_features)] +#![deny(unused_crate_dependencies)] mod cursor; pub mod unescape; diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index bcb714ae4ce2a..2c9b01cd82bad 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -38,6 +38,7 @@ #![feature(trait_upcasting)] #![feature(rustc_attrs)] #![allow(internal_features)] +#![deny(unused_crate_dependencies)] mod async_fn_in_trait; pub mod builtin; diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs index a2970884af40b..51ef09cddb07f 100644 --- a/compiler/rustc_lint_defs/src/lib.rs +++ b/compiler/rustc_lint_defs/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(unused_crate_dependencies)] + pub use self::Level::*; use rustc_ast::node_id::NodeId; use rustc_ast::{AttrId, Attribute}; diff --git a/compiler/rustc_llvm/src/lib.rs b/compiler/rustc_llvm/src/lib.rs index 6a570c97c8888..4f49730b0631e 100644 --- a/compiler/rustc_llvm/src/lib.rs +++ b/compiler/rustc_llvm/src/lib.rs @@ -2,6 +2,7 @@ #![doc(rust_logo)] #![feature(rustdoc_internals)] #![allow(internal_features)] +#![deny(unused_crate_dependencies)] // NOTE: This crate only exists to allow linking on mingw targets. diff --git a/compiler/rustc_log/Cargo.toml b/compiler/rustc_log/Cargo.toml index 3ff86f700a535..bb947fe9df1e0 100644 --- a/compiler/rustc_log/Cargo.toml +++ b/compiler/rustc_log/Cargo.toml @@ -11,11 +11,6 @@ tracing-subscriber = { version = "0.3.3", default-features = false, features = [ tracing-tree = "0.3.0" # 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'] diff --git a/compiler/rustc_log/src/lib.rs b/compiler/rustc_log/src/lib.rs index 41b26ecce3c54..e7553d6393eae 100644 --- a/compiler/rustc_log/src/lib.rs +++ b/compiler/rustc_log/src/lib.rs @@ -38,6 +38,8 @@ //! debugging, you can make changes inside those crates and quickly run main.rs //! to read the debug logs. +#![deny(unused_crate_dependencies)] + use std::env::{self, VarError}; use std::fmt::{self, Display}; use std::io::{self, IsTerminal}; diff --git a/compiler/rustc_macros/src/lib.rs b/compiler/rustc_macros/src/lib.rs index de9c916b4f04f..65f34269cefe9 100644 --- a/compiler/rustc_macros/src/lib.rs +++ b/compiler/rustc_macros/src/lib.rs @@ -7,6 +7,7 @@ #![feature(proc_macro_tracked_env)] #![allow(rustc::default_hash_types)] #![allow(internal_features)] +#![deny(unused_crate_dependencies)] use synstructure::decl_derive; diff --git a/compiler/rustc_metadata/src/lib.rs b/compiler/rustc_metadata/src/lib.rs index acaf9fb0fc32a..5e470ca76ab97 100644 --- a/compiler/rustc_metadata/src/lib.rs +++ b/compiler/rustc_metadata/src/lib.rs @@ -1,6 +1,7 @@ // tidy-alphabetical-start #![allow(internal_features)] #![allow(rustc::potential_query_instability)] +#![deny(unused_crate_dependencies)] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(coroutines)] diff --git a/compiler/rustc_middle/src/lib.rs b/compiler/rustc_middle/src/lib.rs index b499604df87e8..ea739db047679 100644 --- a/compiler/rustc_middle/src/lib.rs +++ b/compiler/rustc_middle/src/lib.rs @@ -28,6 +28,7 @@ #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::potential_query_instability)] #![allow(rustc::untranslatable_diagnostic)] +#![deny(unused_crate_dependencies)] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(allocator_api)] diff --git a/compiler/rustc_mir_build/src/lib.rs b/compiler/rustc_mir_build/src/lib.rs index a1b8b57834911..bf15cd0108f42 100644 --- a/compiler/rustc_mir_build/src/lib.rs +++ b/compiler/rustc_mir_build/src/lib.rs @@ -2,6 +2,7 @@ #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] +#![deny(unused_crate_dependencies)] #![feature(assert_matches)] #![feature(box_patterns)] #![feature(if_let_guard)] diff --git a/compiler/rustc_mir_dataflow/src/lib.rs b/compiler/rustc_mir_dataflow/src/lib.rs index 0b397a67d45cb..e5562542d6377 100644 --- a/compiler/rustc_mir_dataflow/src/lib.rs +++ b/compiler/rustc_mir_dataflow/src/lib.rs @@ -1,3 +1,4 @@ +#![deny(unused_crate_dependencies)] #![feature(associated_type_defaults)] #![feature(box_patterns)] #![feature(exact_size_is_empty)] diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index e4670633914e4..c202cacc2e1eb 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -1,3 +1,4 @@ +#![deny(unused_crate_dependencies)] #![feature(assert_matches)] #![feature(box_patterns)] #![feature(const_type_name)] diff --git a/compiler/rustc_monomorphize/src/lib.rs b/compiler/rustc_monomorphize/src/lib.rs index eb5f8d92603ac..b6ceff19f86e5 100644 --- a/compiler/rustc_monomorphize/src/lib.rs +++ b/compiler/rustc_monomorphize/src/lib.rs @@ -1,3 +1,4 @@ +#![deny(unused_crate_dependencies)] #![feature(array_windows)] #![feature(is_sorted)] diff --git a/compiler/rustc_next_trait_solver/src/lib.rs b/compiler/rustc_next_trait_solver/src/lib.rs index b913a05095c2b..3fd6c06429af6 100644 --- a/compiler/rustc_next_trait_solver/src/lib.rs +++ b/compiler/rustc_next_trait_solver/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(unused_crate_dependencies)] + pub mod canonicalizer; pub mod resolve; pub mod solve; diff --git a/compiler/rustc_parse/src/lib.rs b/compiler/rustc_parse/src/lib.rs index b316327a262de..86ba72a2f6a13 100644 --- a/compiler/rustc_parse/src/lib.rs +++ b/compiler/rustc_parse/src/lib.rs @@ -3,6 +3,7 @@ #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] +#![deny(unused_crate_dependencies)] #![feature(array_windows)] #![feature(box_patterns)] #![feature(debug_closure_helpers)] diff --git a/compiler/rustc_parse_format/src/lib.rs b/compiler/rustc_parse_format/src/lib.rs index ef71333d1c393..67c71a1c2b824 100644 --- a/compiler/rustc_parse_format/src/lib.rs +++ b/compiler/rustc_parse_format/src/lib.rs @@ -12,6 +12,7 @@ // We want to be able to build this crate with a stable compiler, // so no `#![feature]` attributes should be added. #![deny(unstable_features)] +#![deny(unused_crate_dependencies)] use rustc_lexer::unescape; pub use Alignment::*; diff --git a/compiler/rustc_passes/src/lib.rs b/compiler/rustc_passes/src/lib.rs index 045a0a1525bfa..61e9f4a0ce799 100644 --- a/compiler/rustc_passes/src/lib.rs +++ b/compiler/rustc_passes/src/lib.rs @@ -8,6 +8,7 @@ #![doc(rust_logo)] #![feature(rustdoc_internals)] #![allow(internal_features)] +#![deny(unused_crate_dependencies)] #![feature(let_chains)] #![feature(map_try_insert)] #![feature(try_blocks)] diff --git a/compiler/rustc_pattern_analysis/src/lib.rs b/compiler/rustc_pattern_analysis/src/lib.rs index 4155540886a65..10e16d92c5677 100644 --- a/compiler/rustc_pattern_analysis/src/lib.rs +++ b/compiler/rustc_pattern_analysis/src/lib.rs @@ -2,6 +2,9 @@ #![allow(rustc::untranslatable_diagnostic)] #![allow(rustc::diagnostic_outside_of_impl)] +// FIXME(nnethercote) this should be `deny`, but we get some false positives +// for crates used only within `compiler/rustc_pattern_analysis/tests/`. +#![allow(unused_crate_dependencies)] pub mod constructor; #[cfg(feature = "rustc")] diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs index 698b28c626d0a..2d040f56770c5 100644 --- a/compiler/rustc_privacy/src/lib.rs +++ b/compiler/rustc_privacy/src/lib.rs @@ -2,6 +2,7 @@ #![doc(rust_logo)] #![feature(rustdoc_internals)] #![allow(internal_features)] +#![deny(unused_crate_dependencies)] #![feature(associated_type_defaults)] #![feature(try_blocks)] #![feature(let_chains)] diff --git a/compiler/rustc_query_impl/src/lib.rs b/compiler/rustc_query_impl/src/lib.rs index 85f55553af39f..a20c632780325 100644 --- a/compiler/rustc_query_impl/src/lib.rs +++ b/compiler/rustc_query_impl/src/lib.rs @@ -7,6 +7,7 @@ #![feature(rustc_attrs)] #![allow(rustc::potential_query_instability, unused_parens)] #![allow(internal_features)] +#![deny(unused_crate_dependencies)] use crate::plumbing::{__rust_begin_short_backtrace, encode_all_query_results, try_mark_green}; use crate::profiling_support::QueryKeyStringCache; diff --git a/compiler/rustc_query_system/src/lib.rs b/compiler/rustc_query_system/src/lib.rs index fa07877ab9f3e..d1f9af0638f1d 100644 --- a/compiler/rustc_query_system/src/lib.rs +++ b/compiler/rustc_query_system/src/lib.rs @@ -4,6 +4,7 @@ #![feature(min_specialization)] #![feature(let_chains)] #![allow(rustc::potential_query_instability, internal_features)] +#![deny(unused_crate_dependencies)] pub mod cache; pub mod dep_graph; diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index 9557b0f5ebc08..e6f6e8eb9caee 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -11,6 +11,7 @@ #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::potential_query_instability)] #![allow(rustc::untranslatable_diagnostic)] +#![deny(unused_crate_dependencies)] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(assert_matches)] diff --git a/compiler/rustc_sanitizers/src/lib.rs b/compiler/rustc_sanitizers/src/lib.rs index 1f73e255490b2..0536c91295274 100644 --- a/compiler/rustc_sanitizers/src/lib.rs +++ b/compiler/rustc_sanitizers/src/lib.rs @@ -1,4 +1,6 @@ +#![deny(unused_crate_dependencies)] #![feature(let_chains)] + //! Sanitizers support for the Rust compiler. //! //! This crate contains the source code for providing support for the sanitizers to the Rust diff --git a/compiler/rustc_serialize/src/lib.rs b/compiler/rustc_serialize/src/lib.rs index 532b749f9136b..ffcb657c47cb6 100644 --- a/compiler/rustc_serialize/src/lib.rs +++ b/compiler/rustc_serialize/src/lib.rs @@ -7,6 +7,9 @@ )] #![doc(rust_logo)] #![allow(internal_features)] +// FIXME(nnethercote) this should be `deny`, but we get some false positives +// for crates used only within `compiler/rustc_serialize/tests/`. +#![allow(unused_crate_dependencies)] #![feature(rustdoc_internals)] #![feature(const_option)] #![feature(core_intrinsics)] diff --git a/compiler/rustc_session/src/lib.rs b/compiler/rustc_session/src/lib.rs index cb02fbdfee9ed..9cc17d246336e 100644 --- a/compiler/rustc_session/src/lib.rs +++ b/compiler/rustc_session/src/lib.rs @@ -4,6 +4,7 @@ #![feature(map_many_mut)] #![feature(iter_intersperse)] #![allow(internal_features)] +#![deny(unused_crate_dependencies)] pub mod errors; diff --git a/compiler/rustc_smir/src/lib.rs b/compiler/rustc_smir/src/lib.rs index ddd5ea5510a98..55adcb739fd83 100644 --- a/compiler/rustc_smir/src/lib.rs +++ b/compiler/rustc_smir/src/lib.rs @@ -14,6 +14,7 @@ #![feature(rustdoc_internals)] #![allow(internal_features)] #![allow(rustc::usage_of_ty_tykind)] +#![deny(unused_crate_dependencies)] pub mod rustc_internal; diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index 99fcaf917fe9c..1e01db6d68d31 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -17,6 +17,7 @@ // tidy-alphabetical-start #![allow(internal_features)] +#![deny(unused_crate_dependencies)] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(array_windows)] diff --git a/compiler/rustc_symbol_mangling/src/lib.rs b/compiler/rustc_symbol_mangling/src/lib.rs index 745ae41085b29..d8e29779cafd9 100644 --- a/compiler/rustc_symbol_mangling/src/lib.rs +++ b/compiler/rustc_symbol_mangling/src/lib.rs @@ -92,6 +92,7 @@ #![feature(rustdoc_internals)] #![feature(let_chains)] #![allow(internal_features)] +#![deny(unused_crate_dependencies)] use rustc_hir::def::DefKind; use rustc_hir::def_id::{CrateNum, LOCAL_CRATE}; diff --git a/compiler/rustc_target/src/lib.rs b/compiler/rustc_target/src/lib.rs index ecc91ab9a310e..c21e1a5a5dab4 100644 --- a/compiler/rustc_target/src/lib.rs +++ b/compiler/rustc_target/src/lib.rs @@ -9,6 +9,7 @@ // tidy-alphabetical-start #![allow(internal_features)] +#![deny(unused_crate_dependencies)] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(assert_matches)] diff --git a/compiler/rustc_trait_selection/src/lib.rs b/compiler/rustc_trait_selection/src/lib.rs index 381da6f7e2a7a..ccd80fd9f77dd 100644 --- a/compiler/rustc_trait_selection/src/lib.rs +++ b/compiler/rustc_trait_selection/src/lib.rs @@ -16,6 +16,7 @@ #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] +#![deny(unused_crate_dependencies)] #![feature(assert_matches)] #![feature(associated_type_defaults)] #![feature(box_patterns)] diff --git a/compiler/rustc_traits/src/lib.rs b/compiler/rustc_traits/src/lib.rs index bc5436f76f1cd..1f8e465b49b64 100644 --- a/compiler/rustc_traits/src/lib.rs +++ b/compiler/rustc_traits/src/lib.rs @@ -1,5 +1,6 @@ //! Queries that are independent from the main solver code. +#![deny(unused_crate_dependencies)] #![recursion_limit = "256"] mod codegen; diff --git a/compiler/rustc_transmute/src/lib.rs b/compiler/rustc_transmute/src/lib.rs index ffebf7b0721a7..c1f6c2b66e844 100644 --- a/compiler/rustc_transmute/src/lib.rs +++ b/compiler/rustc_transmute/src/lib.rs @@ -1,6 +1,7 @@ #![feature(alloc_layout_extra)] #![feature(never_type)] #![allow(unused_variables)] +#![deny(unused_crate_dependencies)] pub(crate) use rustc_data_structures::fx::{FxIndexMap as Map, FxIndexSet as Set}; diff --git a/compiler/rustc_ty_utils/src/lib.rs b/compiler/rustc_ty_utils/src/lib.rs index bd89265d94264..c159937e70c2b 100644 --- a/compiler/rustc_ty_utils/src/lib.rs +++ b/compiler/rustc_ty_utils/src/lib.rs @@ -8,6 +8,7 @@ #![doc(rust_logo)] #![feature(rustdoc_internals)] #![allow(internal_features)] +#![deny(unused_crate_dependencies)] #![feature(assert_matches)] #![feature(associated_type_defaults)] #![feature(box_patterns)] diff --git a/compiler/rustc_type_ir/src/lib.rs b/compiler/rustc_type_ir/src/lib.rs index 7371646893035..29e0ae5f7c1ee 100644 --- a/compiler/rustc_type_ir/src/lib.rs +++ b/compiler/rustc_type_ir/src/lib.rs @@ -4,6 +4,7 @@ )] #![allow(rustc::usage_of_ty_tykind)] #![cfg_attr(feature = "nightly", allow(internal_features))] +#![deny(unused_crate_dependencies)] #[cfg(feature = "nightly")] extern crate self as rustc_type_ir; diff --git a/compiler/rustc_type_ir_macros/src/lib.rs b/compiler/rustc_type_ir_macros/src/lib.rs index 000bcf2d3b27d..a44f65776c194 100644 --- a/compiler/rustc_type_ir_macros/src/lib.rs +++ b/compiler/rustc_type_ir_macros/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(unused_crate_dependencies)] + use quote::quote; use syn::{parse_quote, visit_mut::VisitMut}; use synstructure::decl_derive; diff --git a/compiler/stable_mir/src/lib.rs b/compiler/stable_mir/src/lib.rs index d9f988935ab19..08490a1594955 100644 --- a/compiler/stable_mir/src/lib.rs +++ b/compiler/stable_mir/src/lib.rs @@ -5,17 +5,18 @@ //! # Note //! //! This API is still completely unstable and subject to change. +//! +//! This crate shall contain all type definitions and APIs that we expect third-party tools to +//! invoke to interact with the compiler. +//! +//! The goal is to eventually be published on +//! [crates.io](https://crates.io). #![doc( html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/", test(attr(allow(unused_variables), deny(warnings))) )] -//! -//! This crate shall contain all type definitions and APIs that we expect third-party tools to invoke to -//! interact with the compiler. -//! -//! The goal is to eventually be published on -//! [crates.io](https://crates.io). +#![deny(unused_crate_dependencies)] use std::fmt; use std::fmt::Debug;