about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2022-04-16 17:11:33 -0700
committerJeremy Fitzhardinge <jsgf@fb.com>2022-04-27 10:04:25 -0700
commitc6bafa7322943643f37f8818bcb16dad28f53d26 (patch)
treef63e5f8cebd10d74580c65a758ca222076936efe /compiler/rustc_errors/src
parent0529a13b5db43952a88504fb16fd561adbcdcc14 (diff)
downloadrust-c6bafa7322943643f37f8818bcb16dad28f53d26.tar.gz
rust-c6bafa7322943643f37f8818bcb16dad28f53d26.zip
Add --json unused-externs-silent with original behaviour
Since Cargo wants to do its own fatal error handling for unused
dependencies, add the option `--json unused-externs-silent` which
has the original behaviour of not indicating non-zero exit status for
`deny`/`forbid`-level unused dependencies.
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/lib.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs
index 3842ccbb2ef..a64133bb7f4 100644
--- a/compiler/rustc_errors/src/lib.rs
+++ b/compiler/rustc_errors/src/lib.rs
@@ -969,10 +969,15 @@ impl Handler {
         self.inner.borrow_mut().emitter.emit_future_breakage_report(diags)
     }
 
-    pub fn emit_unused_externs(&self, lint_level: rustc_lint_defs::Level, unused_externs: &[&str]) {
+    pub fn emit_unused_externs(
+        &self,
+        lint_level: rustc_lint_defs::Level,
+        loud: bool,
+        unused_externs: &[&str],
+    ) {
         let mut inner = self.inner.borrow_mut();
 
-        if lint_level.is_error() {
+        if loud && lint_level.is_error() {
             inner.bump_err_count();
         }