summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2020-08-10 01:57:35 +0200
committerest31 <MTest31@outlook.com>2021-03-08 08:18:46 +0100
commit3a62eb74db63f1b49d5e00c32192498abaf1640f (patch)
treec2a613beba8ecc96f290450a442fc654fb1549b9 /compiler/rustc_interface/src
parent13371b59ee918445ede03cebb741539db807e0e7 (diff)
downloadrust-3a62eb74db63f1b49d5e00c32192498abaf1640f.tar.gz
rust-3a62eb74db63f1b49d5e00c32192498abaf1640f.zip
Emit the lint level of the unused-crate-dependencies
Also, turn off the lint when the unused dependencies json flag
is specified so that cargo doesn't have to supress the lint
Diffstat (limited to 'compiler/rustc_interface/src')
-rw-r--r--compiler/rustc_interface/src/passes.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs
index 5217066bbef..717f4d5a3ba 100644
--- a/compiler/rustc_interface/src/passes.rs
+++ b/compiler/rustc_interface/src/passes.rs
@@ -17,6 +17,7 @@ use rustc_hir::definitions::Definitions;
 use rustc_hir::Crate;
 use rustc_index::vec::IndexVec;
 use rustc_lint::LintStore;
+use rustc_metadata::creader::CStore;
 use rustc_middle::arena::Arena;
 use rustc_middle::dep_graph::DepGraph;
 use rustc_middle::middle;
@@ -836,6 +837,12 @@ fn analysis(tcx: TyCtxt<'_>, cnum: CrateNum) -> Result<()> {
                 });
 
                 sess.time("looking_for_derive_registrar", || proc_macro_decls::find(tcx));
+
+                let cstore = tcx
+                    .cstore_as_any()
+                    .downcast_ref::<CStore>()
+                    .expect("`tcx.cstore` is not a `CStore`");
+                cstore.report_unused_deps(tcx);
             },
             {
                 par_iter(&tcx.hir().krate().modules).for_each(|(&module, _)| {