From 69a19bfd4345a73836194f28e35c620d9005a825 Mon Sep 17 00:00:00 2001 From: Ryan Levick Date: Thu, 27 May 2021 19:19:39 +0200 Subject: [PATCH 1/9] Initial support for force-warns --- compiler/rustc_lint/src/levels.rs | 9 ++++++ compiler/rustc_middle/src/lint.rs | 31 ++++++++++++++++--- compiler/rustc_session/src/config.rs | 19 ++++++++++-- compiler/rustc_session/src/options.rs | 1 + .../force-warn/force-allow-all-warnings.rs | 9 ++++++ .../force-allow-all-warnings.stderr | 10 ++++++ .../lint/force-warn/force-allow-by-default.rs | 11 +++++++ .../force-warn/force-allow-by-default.stderr | 10 ++++++ .../ui/lint/force-warn/force-allowed-deny.rs | 10 ++++++ .../ui/lint/force-warn/force-allowed-group.rs | 12 +++++++ .../force-warn/force-allowed-group.stderr | 12 +++++++ .../lint/force-warn/force-allowed-warning.rs | 9 ++++++ .../force-warn/force-allowed-warning.stderr | 10 ++++++ 13 files changed, 146 insertions(+), 7 deletions(-) create mode 100644 src/test/ui/lint/force-warn/force-allow-all-warnings.rs create mode 100644 src/test/ui/lint/force-warn/force-allow-all-warnings.stderr create mode 100644 src/test/ui/lint/force-warn/force-allow-by-default.rs create mode 100644 src/test/ui/lint/force-warn/force-allow-by-default.stderr create mode 100644 src/test/ui/lint/force-warn/force-allowed-deny.rs create mode 100644 src/test/ui/lint/force-warn/force-allowed-group.rs create mode 100644 src/test/ui/lint/force-warn/force-allowed-group.stderr create mode 100644 src/test/ui/lint/force-warn/force-allowed-warning.rs create mode 100644 src/test/ui/lint/force-warn/force-allowed-warning.stderr diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index 91cdef9b089fa..482ec58fd1afd 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -109,6 +109,11 @@ impl<'s> LintLevelsBuilder<'s> { } } + for lint_name in &sess.opts.force_warns { + store.check_lint_name_cmdline(sess, &lint_name, Level::Allow); // FIXME level is wrong + self.sets.force_warns.insert(lint_name.to_uppercase()); + } + self.sets.list.push(LintSet::CommandLine { specs }); } @@ -142,6 +147,9 @@ impl<'s> LintLevelsBuilder<'s> { LintLevelSource::Default => false, LintLevelSource::Node(symbol, _, _) => self.store.is_lint_group(symbol), LintLevelSource::CommandLine(symbol, _) => self.store.is_lint_group(symbol), + LintLevelSource::ForceWarn(symbol) => { + bug!("forced warn lint returned a forbid lint level") + } }; debug!( "fcw_warning={:?}, specs.get(&id) = {:?}, old_src={:?}, id_name={:?}", @@ -166,6 +174,7 @@ impl<'s> LintLevelsBuilder<'s> { LintLevelSource::CommandLine(_, _) => { diag_builder.note("`forbid` lint level was set on command line"); } + _ => bug!("forced warn lint returned a forbid lint level"), } diag_builder.emit(); }; diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs index 38d0793a6825f..af9bc5ebe7073 100644 --- a/compiler/rustc_middle/src/lint.rs +++ b/compiler/rustc_middle/src/lint.rs @@ -1,7 +1,8 @@ use std::cmp; use crate::ich::StableHashingContext; -use rustc_data_structures::fx::FxHashMap; +use chalk_ir::Substitution; +use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_errors::{DiagnosticBuilder, DiagnosticId}; use rustc_hir::HirId; @@ -28,6 +29,9 @@ pub enum LintLevelSource { /// The provided `Level` is the level specified on the command line. /// (The actual level may be lower due to `--cap-lints`.) CommandLine(Symbol, Level), + + /// Lint is being forced to warn no matter what. + ForceWarn(Symbol), } impl LintLevelSource { @@ -36,6 +40,7 @@ impl LintLevelSource { LintLevelSource::Default => symbol::kw::Default, LintLevelSource::Node(name, _, _) => name, LintLevelSource::CommandLine(name, _) => name, + LintLevelSource::ForceWarn(name) => name, } } @@ -44,6 +49,7 @@ impl LintLevelSource { LintLevelSource::Default => DUMMY_SP, LintLevelSource::Node(_, span, _) => span, LintLevelSource::CommandLine(_, _) => DUMMY_SP, + LintLevelSource::ForceWarn(_) => DUMMY_SP, } } } @@ -55,6 +61,7 @@ pub type LevelAndSource = (Level, LintLevelSource); pub struct LintLevelSets { pub list: Vec, pub lint_cap: Level, + pub force_warns: FxHashSet, } #[derive(Debug)] @@ -73,7 +80,11 @@ pub enum LintSet { impl LintLevelSets { pub fn new() -> Self { - LintLevelSets { list: Vec::new(), lint_cap: Level::Forbid } + LintLevelSets { + list: Vec::new(), + lint_cap: Level::Forbid, + force_warns: FxHashSet::default(), + } } pub fn get_lint_level( @@ -83,6 +94,11 @@ impl LintLevelSets { aux: Option<&FxHashMap>, sess: &Session, ) -> LevelAndSource { + // Check whether we should always warn + if self.force_warns.contains(lint.name) { + return (Level::Warn, LintLevelSource::ForceWarn(Symbol::intern(lint.name))); + } + let (level, mut src) = self.get_lint_id_level(LintId::of(lint), idx, aux); // If `level` is none then we actually assume the default level for this @@ -176,11 +192,11 @@ impl LintLevelMap { impl<'a> HashStable> for LintLevelMap { #[inline] fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { - let LintLevelMap { ref sets, ref id_to_set } = *self; + let LintLevelMap { ref sets, ref id_to_set, .. } = *self; id_to_set.hash_stable(hcx, hasher); - let LintLevelSets { ref list, lint_cap } = *sets; + let LintLevelSets { ref list, lint_cap, .. } = *sets; lint_cap.hash_stable(hcx, hasher); @@ -346,6 +362,13 @@ pub fn struct_lint_level<'s, 'd>( ); } } + LintLevelSource::ForceWarn(_) => { + sess.diag_note_once( + &mut err, + DiagnosticMessageId::from(lint), + "Warning forced by `force-warns` commandline option", + ); + } } err.code(DiagnosticId::Lint { name, has_future_breakage }); diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 1c6fad2ae8e1c..5a9da2f2590e6 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -677,6 +677,7 @@ impl Default for Options { optimize: OptLevel::No, debuginfo: DebugInfo::None, lint_opts: Vec::new(), + force_warns: Vec::new(), lint_cap: None, describe_lints: false, output_types: OutputTypes(BTreeMap::new()), @@ -1092,6 +1093,13 @@ pub fn rustc_short_optgroups() -> Vec { level", "LEVEL", ), + opt::multi_s( + "", + "force-warns", + "Specifiy lints that should warn even if \ + they are allowed somewhere else", + "LINT", + ), opt::multi_s("C", "codegen", "Set a codegen option", "OPT[=VALUE]"), opt::flag_s("V", "version", "Print version info and exit"), opt::flag_s("v", "verbose", "Use verbose output"), @@ -1156,7 +1164,7 @@ pub fn rustc_optgroups() -> Vec { pub fn get_cmd_lint_options( matches: &getopts::Matches, error_format: ErrorOutputType, -) -> (Vec<(String, lint::Level)>, bool, Option) { +) -> (Vec<(String, lint::Level)>, bool, Option, Vec) { let mut lint_opts_with_position = vec![]; let mut describe_lints = false; @@ -1189,7 +1197,10 @@ pub fn get_cmd_lint_options( lint::Level::from_str(&cap) .unwrap_or_else(|| early_error(error_format, &format!("unknown lint level: `{}`", cap))) }); - (lint_opts, describe_lints, lint_cap) + + let force_warns = matches.opt_strs("force-warns"); + + (lint_opts, describe_lints, lint_cap, force_warns) } /// Parses the `--color` flag. @@ -1926,7 +1937,8 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { let crate_types = parse_crate_types_from_list(unparsed_crate_types) .unwrap_or_else(|e| early_error(error_format, &e[..])); - let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format); + let (lint_opts, describe_lints, lint_cap, force_warns) = + get_cmd_lint_options(matches, error_format); let mut debugging_opts = DebuggingOptions::build(matches, error_format); check_debug_option_stability(&debugging_opts, error_format, json_rendered); @@ -2100,6 +2112,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { optimize: opt_level, debuginfo, lint_opts, + force_warns, lint_cap, describe_lints, output_types, diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index c9f95ed1224d0..1d4bb55a22c2f 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -130,6 +130,7 @@ top_level_options!( debuginfo: DebugInfo [TRACKED], lint_opts: Vec<(String, lint::Level)> [TRACKED], lint_cap: Option [TRACKED], + force_warns: Vec [TRACKED], describe_lints: bool [UNTRACKED], output_types: OutputTypes [TRACKED], search_paths: Vec [UNTRACKED], diff --git a/src/test/ui/lint/force-warn/force-allow-all-warnings.rs b/src/test/ui/lint/force-warn/force-allow-all-warnings.rs new file mode 100644 index 0000000000000..5501faa437aae --- /dev/null +++ b/src/test/ui/lint/force-warn/force-allow-all-warnings.rs @@ -0,0 +1,9 @@ +// compile-flags: --force-warns dead_code +// check-pass + +#![allow(warnings)] + +fn dead_function() {} +//~^ WARN function is never used + +fn main() {} diff --git a/src/test/ui/lint/force-warn/force-allow-all-warnings.stderr b/src/test/ui/lint/force-warn/force-allow-all-warnings.stderr new file mode 100644 index 0000000000000..c19f1fe780fb6 --- /dev/null +++ b/src/test/ui/lint/force-warn/force-allow-all-warnings.stderr @@ -0,0 +1,10 @@ +warning: function is never used: `dead_function` + --> $DIR/force-allow-all-warnings.rs:6:4 + | +LL | fn dead_function() {} + | ^^^^^^^^^^^^^ + | + = note: Warning forced by `force-warns` commandline option + +warning: 1 warning emitted + diff --git a/src/test/ui/lint/force-warn/force-allow-by-default.rs b/src/test/ui/lint/force-warn/force-allow-by-default.rs new file mode 100644 index 0000000000000..d4a5056ddf3db --- /dev/null +++ b/src/test/ui/lint/force-warn/force-allow-by-default.rs @@ -0,0 +1,11 @@ +// compile-flags: --force-warns elided_lifetimes_in_paths +// check-pass + +struct Foo<'a> { + x: &'a u32, +} + +fn foo(x: &Foo) {} +//~^ WARN hidden lifetime parameters in types are deprecated + +fn main() {} diff --git a/src/test/ui/lint/force-warn/force-allow-by-default.stderr b/src/test/ui/lint/force-warn/force-allow-by-default.stderr new file mode 100644 index 0000000000000..9f62e85e54527 --- /dev/null +++ b/src/test/ui/lint/force-warn/force-allow-by-default.stderr @@ -0,0 +1,10 @@ +warning: hidden lifetime parameters in types are deprecated + --> $DIR/force-allow-by-default.rs:8:12 + | +LL | fn foo(x: &Foo) {} + | ^^^- help: indicate the anonymous lifetime: `<'_>` + | + = note: Warning forced by `force-warns` commandline option + +warning: 1 warning emitted + diff --git a/src/test/ui/lint/force-warn/force-allowed-deny.rs b/src/test/ui/lint/force-warn/force-allowed-deny.rs new file mode 100644 index 0000000000000..b34fb5d8b8453 --- /dev/null +++ b/src/test/ui/lint/force-warn/force-allowed-deny.rs @@ -0,0 +1,10 @@ +// ignore-test +// compile-flags: --force-warns arithmetic_overflow +// check-pass + +#![allow(arithmetic_overflow)] + +fn main() { + 1_i32 << 32; + //~^ WARN this arithmetic operation will overflow +} diff --git a/src/test/ui/lint/force-warn/force-allowed-group.rs b/src/test/ui/lint/force-warn/force-allowed-group.rs new file mode 100644 index 0000000000000..fe8b106a0860b --- /dev/null +++ b/src/test/ui/lint/force-warn/force-allowed-group.rs @@ -0,0 +1,12 @@ +// compile-flags: --force-warns bare_trait_objects +// check-pass + +#![allow(rust_2018_compatibility)] + +pub trait SomeTrait {} + +pub fn function(_x: Box) {} +//~^ WARN trait objects without an explicit `dyn` are deprecated +//~| WARN this was previously accepted by the compiler + +fn main() {} diff --git a/src/test/ui/lint/force-warn/force-allowed-group.stderr b/src/test/ui/lint/force-warn/force-allowed-group.stderr new file mode 100644 index 0000000000000..9fdd998ebf41d --- /dev/null +++ b/src/test/ui/lint/force-warn/force-allowed-group.stderr @@ -0,0 +1,12 @@ +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/force-allowed-group.rs:8:25 + | +LL | pub fn function(_x: Box) {} + | ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` + | + = note: Warning forced by `force-warns` commandline option + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = note: for more information, see issue #80165 + +warning: 1 warning emitted + diff --git a/src/test/ui/lint/force-warn/force-allowed-warning.rs b/src/test/ui/lint/force-warn/force-allowed-warning.rs new file mode 100644 index 0000000000000..5c83c525e38b5 --- /dev/null +++ b/src/test/ui/lint/force-warn/force-allowed-warning.rs @@ -0,0 +1,9 @@ +// compile-flags: --force-warns dead_code +// check-pass + +#![allow(dead_code)] + +fn dead_function() {} +//~^ WARN function is never used + +fn main() {} diff --git a/src/test/ui/lint/force-warn/force-allowed-warning.stderr b/src/test/ui/lint/force-warn/force-allowed-warning.stderr new file mode 100644 index 0000000000000..9ae32e89a98d2 --- /dev/null +++ b/src/test/ui/lint/force-warn/force-allowed-warning.stderr @@ -0,0 +1,10 @@ +warning: function is never used: `dead_function` + --> $DIR/force-allowed-warning.rs:6:4 + | +LL | fn dead_function() {} + | ^^^^^^^^^^^^^ + | + = note: Warning forced by `force-warns` commandline option + +warning: 1 warning emitted + From 4675690ac4022a937f6817570e06f987c2efbc61 Mon Sep 17 00:00:00 2001 From: Ryan Levick Date: Tue, 1 Jun 2021 18:01:13 +0200 Subject: [PATCH 2/9] Fix issues and add test --- compiler/rustc_lint/src/levels.rs | 2 +- compiler/rustc_middle/src/lint.rs | 1 - src/test/ui/lint/force-warn/force-allowed-group.rs | 2 +- src/test/ui/lint/force-warn/force-warn-group.rs | 13 +++++++++++++ 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 src/test/ui/lint/force-warn/force-warn-group.rs diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index 482ec58fd1afd..4f3d98304e7a0 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -147,7 +147,7 @@ impl<'s> LintLevelsBuilder<'s> { LintLevelSource::Default => false, LintLevelSource::Node(symbol, _, _) => self.store.is_lint_group(symbol), LintLevelSource::CommandLine(symbol, _) => self.store.is_lint_group(symbol), - LintLevelSource::ForceWarn(symbol) => { + LintLevelSource::ForceWarn(_symbol) => { bug!("forced warn lint returned a forbid lint level") } }; diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs index af9bc5ebe7073..f3088326db804 100644 --- a/compiler/rustc_middle/src/lint.rs +++ b/compiler/rustc_middle/src/lint.rs @@ -1,7 +1,6 @@ use std::cmp; use crate::ich::StableHashingContext; -use chalk_ir::Substitution; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_errors::{DiagnosticBuilder, DiagnosticId}; diff --git a/src/test/ui/lint/force-warn/force-allowed-group.rs b/src/test/ui/lint/force-warn/force-allowed-group.rs index fe8b106a0860b..b68b979ca11c8 100644 --- a/src/test/ui/lint/force-warn/force-allowed-group.rs +++ b/src/test/ui/lint/force-warn/force-allowed-group.rs @@ -1,7 +1,7 @@ // compile-flags: --force-warns bare_trait_objects // check-pass -#![allow(rust_2018_compatibility)] +#![allow(rust_2018_idioms)] pub trait SomeTrait {} diff --git a/src/test/ui/lint/force-warn/force-warn-group.rs b/src/test/ui/lint/force-warn/force-warn-group.rs new file mode 100644 index 0000000000000..3206d75e940ca --- /dev/null +++ b/src/test/ui/lint/force-warn/force-warn-group.rs @@ -0,0 +1,13 @@ +// ignore-test +// compile-flags: --force-warns rust_2018_idioms +// check-pass + +#![allow(rust_2018_idioms)] + +pub trait SomeTrait {} + +pub fn function(_x: Box) {} +//~^ WARN trait objects without an explicit `dyn` are deprecated +//~| WARN this was previously accepted by the compiler + +fn main() {} From 3b206b7a70b8e001f21c823b24f0fa363e920104 Mon Sep 17 00:00:00 2001 From: Ryan Levick Date: Wed, 2 Jun 2021 17:09:07 +0200 Subject: [PATCH 3/9] Force warn on lint groups as well --- compiler/rustc_lint/src/context.rs | 37 ++++++++++++------- compiler/rustc_lint/src/levels.rs | 11 ++++-- compiler/rustc_middle/src/lint.rs | 4 +- compiler/rustc_session/src/config.rs | 13 ++++++- src/librustdoc/config.rs | 3 +- src/librustdoc/lib.rs | 8 ++++ ...lt.rs => force-allowed-by-default-lint.rs} | 0 ...r => force-allowed-by-default-lint.stderr} | 2 +- ... => force-allowed-deny-by-default-lint.rs} | 0 ...gs.rs => force-lint-allow-all-warnings.rs} | 0 ...r => force-lint-allow-all-warnings.stderr} | 2 +- .../force-lint-group-allow-all-warnings.rs | 9 +++++ ...force-lint-group-allow-all-warnings.stderr | 10 +++++ ...roup.rs => force-lint-in-allowed-group.rs} | 0 .../force-lint-in-allowed-group.stderr | 12 ++++++ .../force-warn-group-allow-warning.rs | 12 ++++++ .../force-warn-group-allow-warning.stderr | 12 ++++++ .../ui/lint/force-warn/force-warn-group.rs | 1 - ...d-group.stderr => force-warn-group.stderr} | 2 +- 19 files changed, 113 insertions(+), 25 deletions(-) rename src/test/ui/lint/force-warn/{force-allow-by-default.rs => force-allowed-by-default-lint.rs} (100%) rename src/test/ui/lint/force-warn/{force-allow-by-default.stderr => force-allowed-by-default-lint.stderr} (83%) rename src/test/ui/lint/force-warn/{force-allowed-deny.rs => force-allowed-deny-by-default-lint.rs} (100%) rename src/test/ui/lint/force-warn/{force-allow-all-warnings.rs => force-lint-allow-all-warnings.rs} (100%) rename src/test/ui/lint/force-warn/{force-allow-all-warnings.stderr => force-lint-allow-all-warnings.stderr} (80%) create mode 100644 src/test/ui/lint/force-warn/force-lint-group-allow-all-warnings.rs create mode 100644 src/test/ui/lint/force-warn/force-lint-group-allow-all-warnings.stderr rename src/test/ui/lint/force-warn/{force-allowed-group.rs => force-lint-in-allowed-group.rs} (100%) create mode 100644 src/test/ui/lint/force-warn/force-lint-in-allowed-group.stderr create mode 100644 src/test/ui/lint/force-warn/force-warn-group-allow-warning.rs create mode 100644 src/test/ui/lint/force-warn/force-warn-group-allow-warning.stderr rename src/test/ui/lint/force-warn/{force-allowed-group.stderr => force-warn-group.stderr} (92%) diff --git a/compiler/rustc_lint/src/context.rs b/compiler/rustc_lint/src/context.rs index c1d6a4f1de1ff..5c54f06acface 100644 --- a/compiler/rustc_lint/src/context.rs +++ b/compiler/rustc_lint/src/context.rs @@ -334,8 +334,14 @@ impl LintStore { } } - /// Checks the validity of lint names derived from the command line - pub fn check_lint_name_cmdline(&self, sess: &Session, lint_name: &str, level: Level) { + /// Checks the validity of lint names derived from the command line. Returns + /// true if the lint is valid, false otherwise. + pub fn check_lint_name_cmdline( + &self, + sess: &Session, + lint_name: &str, + level: Option, + ) -> bool { let db = match self.check_lint_name(lint_name, None) { CheckLintNameResult::Ok(_) => None, CheckLintNameResult::Warning(ref msg, _) => Some(sess.struct_warn(msg)), @@ -361,18 +367,23 @@ impl LintStore { }; if let Some(mut db) = db { - let msg = format!( - "requested on the command line with `{} {}`", - match level { - Level::Allow => "-A", - Level::Warn => "-W", - Level::Deny => "-D", - Level::Forbid => "-F", - }, - lint_name - ); - db.note(&msg); + if let Some(level) = level { + let msg = format!( + "requested on the command line with `{} {}`", + match level { + Level::Allow => "-A", + Level::Warn => "-W", + Level::Deny => "-D", + Level::Forbid => "-F", + }, + lint_name + ); + db.note(&msg); + } db.emit(); + false + } else { + true } } diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index 4f3d98304e7a0..0ee434f5fb50b 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -88,7 +88,7 @@ impl<'s> LintLevelsBuilder<'s> { self.sets.lint_cap = sess.opts.lint_cap.unwrap_or(Level::Forbid); for &(ref lint_name, level) in &sess.opts.lint_opts { - store.check_lint_name_cmdline(sess, &lint_name, level); + store.check_lint_name_cmdline(sess, &lint_name, Some(level)); let orig_level = level; // If the cap is less than this specified level, e.g., if we've got @@ -110,8 +110,13 @@ impl<'s> LintLevelsBuilder<'s> { } for lint_name in &sess.opts.force_warns { - store.check_lint_name_cmdline(sess, &lint_name, Level::Allow); // FIXME level is wrong - self.sets.force_warns.insert(lint_name.to_uppercase()); + let valid = store.check_lint_name_cmdline(sess, lint_name, None); + if valid { + let lints = store + .find_lints(lint_name) + .unwrap_or_else(|_| bug!("A valid lint failed to produce a lint ids")); + self.sets.force_warns.extend(&lints); + } } self.sets.list.push(LintSet::CommandLine { specs }); diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs index f3088326db804..85080354e4d72 100644 --- a/compiler/rustc_middle/src/lint.rs +++ b/compiler/rustc_middle/src/lint.rs @@ -60,7 +60,7 @@ pub type LevelAndSource = (Level, LintLevelSource); pub struct LintLevelSets { pub list: Vec, pub lint_cap: Level, - pub force_warns: FxHashSet, + pub force_warns: FxHashSet, } #[derive(Debug)] @@ -94,7 +94,7 @@ impl LintLevelSets { sess: &Session, ) -> LevelAndSource { // Check whether we should always warn - if self.force_warns.contains(lint.name) { + if self.force_warns.contains(&LintId::of(lint)) { return (Level::Warn, LintLevelSource::ForceWarn(Symbol::intern(lint.name))); } diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 5a9da2f2590e6..9306abc85ba37 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1164,6 +1164,7 @@ pub fn rustc_optgroups() -> Vec { pub fn get_cmd_lint_options( matches: &getopts::Matches, error_format: ErrorOutputType, + debugging_opts: &DebuggingOptions, ) -> (Vec<(String, lint::Level)>, bool, Option, Vec) { let mut lint_opts_with_position = vec![]; let mut describe_lints = false; @@ -1198,6 +1199,14 @@ pub fn get_cmd_lint_options( .unwrap_or_else(|| early_error(error_format, &format!("unknown lint level: `{}`", cap))) }); + if !debugging_opts.unstable_options && matches.opt_present("force-warns") { + early_error( + error_format, + "the `-Z unstable-options` flag must also be passed to enable \ + the flag `--force-warns=lints`", + ); + } + let force_warns = matches.opt_strs("force-warns"); (lint_opts, describe_lints, lint_cap, force_warns) @@ -1937,10 +1946,10 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { let crate_types = parse_crate_types_from_list(unparsed_crate_types) .unwrap_or_else(|e| early_error(error_format, &e[..])); + let mut debugging_opts = DebuggingOptions::build(matches, error_format); let (lint_opts, describe_lints, lint_cap, force_warns) = - get_cmd_lint_options(matches, error_format); + get_cmd_lint_options(matches, error_format, &debugging_opts); - let mut debugging_opts = DebuggingOptions::build(matches, error_format); check_debug_option_stability(&debugging_opts, error_format, json_rendered); if !debugging_opts.unstable_options && json_unused_externs { diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 6e1fdf67a652f..29e8578d944c7 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -635,7 +635,8 @@ impl Options { let generate_redirect_map = matches.opt_present("generate-redirect-map"); let show_type_layout = matches.opt_present("show-type-layout"); - let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format); + let (lint_opts, describe_lints, lint_cap, _) = + get_cmd_lint_options(matches, error_format, &debugging_opts); Ok(Options { input, diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 6488625c5a84d..3ad3a53069072 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -510,6 +510,14 @@ fn opts() -> Vec { "LEVEL", ) }), + unstable("force-warns", |o| { + o.optopt( + "", + "force-warns", + "Lints that will warn even if allowed somewhere else", + "LINTS", + ) + }), unstable("index-page", |o| { o.optopt("", "index-page", "Markdown file to be used as index page", "PATH") }), diff --git a/src/test/ui/lint/force-warn/force-allow-by-default.rs b/src/test/ui/lint/force-warn/force-allowed-by-default-lint.rs similarity index 100% rename from src/test/ui/lint/force-warn/force-allow-by-default.rs rename to src/test/ui/lint/force-warn/force-allowed-by-default-lint.rs diff --git a/src/test/ui/lint/force-warn/force-allow-by-default.stderr b/src/test/ui/lint/force-warn/force-allowed-by-default-lint.stderr similarity index 83% rename from src/test/ui/lint/force-warn/force-allow-by-default.stderr rename to src/test/ui/lint/force-warn/force-allowed-by-default-lint.stderr index 9f62e85e54527..24ccfe6107738 100644 --- a/src/test/ui/lint/force-warn/force-allow-by-default.stderr +++ b/src/test/ui/lint/force-warn/force-allowed-by-default-lint.stderr @@ -1,5 +1,5 @@ warning: hidden lifetime parameters in types are deprecated - --> $DIR/force-allow-by-default.rs:8:12 + --> $DIR/force-allowed-by-default-lint.rs:8:12 | LL | fn foo(x: &Foo) {} | ^^^- help: indicate the anonymous lifetime: `<'_>` diff --git a/src/test/ui/lint/force-warn/force-allowed-deny.rs b/src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.rs similarity index 100% rename from src/test/ui/lint/force-warn/force-allowed-deny.rs rename to src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.rs diff --git a/src/test/ui/lint/force-warn/force-allow-all-warnings.rs b/src/test/ui/lint/force-warn/force-lint-allow-all-warnings.rs similarity index 100% rename from src/test/ui/lint/force-warn/force-allow-all-warnings.rs rename to src/test/ui/lint/force-warn/force-lint-allow-all-warnings.rs diff --git a/src/test/ui/lint/force-warn/force-allow-all-warnings.stderr b/src/test/ui/lint/force-warn/force-lint-allow-all-warnings.stderr similarity index 80% rename from src/test/ui/lint/force-warn/force-allow-all-warnings.stderr rename to src/test/ui/lint/force-warn/force-lint-allow-all-warnings.stderr index c19f1fe780fb6..dc9af8997b28f 100644 --- a/src/test/ui/lint/force-warn/force-allow-all-warnings.stderr +++ b/src/test/ui/lint/force-warn/force-lint-allow-all-warnings.stderr @@ -1,5 +1,5 @@ warning: function is never used: `dead_function` - --> $DIR/force-allow-all-warnings.rs:6:4 + --> $DIR/force-lint-allow-all-warnings.rs:6:4 | LL | fn dead_function() {} | ^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/force-warn/force-lint-group-allow-all-warnings.rs b/src/test/ui/lint/force-warn/force-lint-group-allow-all-warnings.rs new file mode 100644 index 0000000000000..9009971f0cff3 --- /dev/null +++ b/src/test/ui/lint/force-warn/force-lint-group-allow-all-warnings.rs @@ -0,0 +1,9 @@ +// compile-flags: --force-warns nonstandard_style +// check-pass + +#![allow(warnings)] + +pub fn FUNCTION() {} +//~^ WARN function `FUNCTION` should have a snake case name + +fn main() {} diff --git a/src/test/ui/lint/force-warn/force-lint-group-allow-all-warnings.stderr b/src/test/ui/lint/force-warn/force-lint-group-allow-all-warnings.stderr new file mode 100644 index 0000000000000..3965d5ca2385d --- /dev/null +++ b/src/test/ui/lint/force-warn/force-lint-group-allow-all-warnings.stderr @@ -0,0 +1,10 @@ +warning: function `FUNCTION` should have a snake case name + --> $DIR/force-lint-group-allow-all-warnings.rs:6:8 + | +LL | pub fn FUNCTION() {} + | ^^^^^^^^ help: convert the identifier to snake case: `function` + | + = note: Warning forced by `force-warns` commandline option + +warning: 1 warning emitted + diff --git a/src/test/ui/lint/force-warn/force-allowed-group.rs b/src/test/ui/lint/force-warn/force-lint-in-allowed-group.rs similarity index 100% rename from src/test/ui/lint/force-warn/force-allowed-group.rs rename to src/test/ui/lint/force-warn/force-lint-in-allowed-group.rs diff --git a/src/test/ui/lint/force-warn/force-lint-in-allowed-group.stderr b/src/test/ui/lint/force-warn/force-lint-in-allowed-group.stderr new file mode 100644 index 0000000000000..a28b14ebc9b11 --- /dev/null +++ b/src/test/ui/lint/force-warn/force-lint-in-allowed-group.stderr @@ -0,0 +1,12 @@ +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/force-lint-in-allowed-group.rs:8:25 + | +LL | pub fn function(_x: Box) {} + | ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` + | + = note: Warning forced by `force-warns` commandline option + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = note: for more information, see issue #80165 + +warning: 1 warning emitted + diff --git a/src/test/ui/lint/force-warn/force-warn-group-allow-warning.rs b/src/test/ui/lint/force-warn/force-warn-group-allow-warning.rs new file mode 100644 index 0000000000000..357a79b383d02 --- /dev/null +++ b/src/test/ui/lint/force-warn/force-warn-group-allow-warning.rs @@ -0,0 +1,12 @@ +// compile-flags: --force-warns rust_2018_idioms +// check-pass + +#![allow(bare_trait_objects)] + +pub trait SomeTrait {} + +pub fn function(_x: Box) {} +//~^ WARN trait objects without an explicit `dyn` are deprecated +//~| WARN this was previously accepted by the compiler + +fn main() {} diff --git a/src/test/ui/lint/force-warn/force-warn-group-allow-warning.stderr b/src/test/ui/lint/force-warn/force-warn-group-allow-warning.stderr new file mode 100644 index 0000000000000..f57dd1e70dc0a --- /dev/null +++ b/src/test/ui/lint/force-warn/force-warn-group-allow-warning.stderr @@ -0,0 +1,12 @@ +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/force-warn-group-allow-warning.rs:8:25 + | +LL | pub fn function(_x: Box) {} + | ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` + | + = note: Warning forced by `force-warns` commandline option + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! + = note: for more information, see issue #80165 + +warning: 1 warning emitted + diff --git a/src/test/ui/lint/force-warn/force-warn-group.rs b/src/test/ui/lint/force-warn/force-warn-group.rs index 3206d75e940ca..a4615df42de2d 100644 --- a/src/test/ui/lint/force-warn/force-warn-group.rs +++ b/src/test/ui/lint/force-warn/force-warn-group.rs @@ -1,4 +1,3 @@ -// ignore-test // compile-flags: --force-warns rust_2018_idioms // check-pass diff --git a/src/test/ui/lint/force-warn/force-allowed-group.stderr b/src/test/ui/lint/force-warn/force-warn-group.stderr similarity index 92% rename from src/test/ui/lint/force-warn/force-allowed-group.stderr rename to src/test/ui/lint/force-warn/force-warn-group.stderr index 9fdd998ebf41d..f2b0ce04b541b 100644 --- a/src/test/ui/lint/force-warn/force-allowed-group.stderr +++ b/src/test/ui/lint/force-warn/force-warn-group.stderr @@ -1,5 +1,5 @@ warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/force-allowed-group.rs:8:25 + --> $DIR/force-warn-group.rs:8:25 | LL | pub fn function(_x: Box) {} | ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` From 8d4841cf0efcda254a06d34c4b2da4bdf58de710 Mon Sep 17 00:00:00 2001 From: Ryan Levick Date: Wed, 2 Jun 2021 17:18:52 +0200 Subject: [PATCH 4/9] Add final test --- .../force-allowed-deny-by-default-lint.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.rs b/src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.rs index b34fb5d8b8453..afd2d6ec322e4 100644 --- a/src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.rs +++ b/src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.rs @@ -1,10 +1,9 @@ -// ignore-test -// compile-flags: --force-warns arithmetic_overflow +// compile-flags: --force-warns const_err // check-pass -#![allow(arithmetic_overflow)] +#![allow(const_err)] +const C: i32 = 1 / 0; +//~^ WARN any use of this value will cause an error +//~| WARN this was previously accepted by the compiler -fn main() { - 1_i32 << 32; - //~^ WARN this arithmetic operation will overflow -} +fn main() {} From e3e31a1912ec8eb8e41992685775074f39add5aa Mon Sep 17 00:00:00 2001 From: Ryan Levick Date: Wed, 2 Jun 2021 17:22:24 +0200 Subject: [PATCH 5/9] Add missing stderr file --- .../force-allowed-deny-by-default-lint.stderr | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.stderr diff --git a/src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.stderr b/src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.stderr new file mode 100644 index 0000000000000..abaf424e532d3 --- /dev/null +++ b/src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.stderr @@ -0,0 +1,14 @@ +warning: any use of this value will cause an error + --> $DIR/force-allowed-deny-by-default-lint.rs:5:16 + | +LL | const C: i32 = 1 / 0; + | ---------------^^^^^- + | | + | attempt to divide `1_i32` by zero + | + = note: Warning forced by `force-warns` commandline option + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + +warning: 1 warning emitted + From dc2db7389945ce13e28c017c69991dc4e0794c79 Mon Sep 17 00:00:00 2001 From: Ryan Levick Date: Wed, 2 Jun 2021 17:25:24 +0200 Subject: [PATCH 6/9] Add deny-by-default test --- .../lint/force-warn/force-deny-by-default-lint.rs | 8 ++++++++ .../force-warn/force-deny-by-default-lint.stderr | 14 ++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/test/ui/lint/force-warn/force-deny-by-default-lint.rs create mode 100644 src/test/ui/lint/force-warn/force-deny-by-default-lint.stderr diff --git a/src/test/ui/lint/force-warn/force-deny-by-default-lint.rs b/src/test/ui/lint/force-warn/force-deny-by-default-lint.rs new file mode 100644 index 0000000000000..4f267f085d544 --- /dev/null +++ b/src/test/ui/lint/force-warn/force-deny-by-default-lint.rs @@ -0,0 +1,8 @@ +// compile-flags: --force-warns const_err +// check-pass + +const C: i32 = 1 / 0; +//~^ WARN any use of this value will cause an error +//~| WARN this was previously accepted by the compiler + +fn main() {} diff --git a/src/test/ui/lint/force-warn/force-deny-by-default-lint.stderr b/src/test/ui/lint/force-warn/force-deny-by-default-lint.stderr new file mode 100644 index 0000000000000..a1905034f5b5f --- /dev/null +++ b/src/test/ui/lint/force-warn/force-deny-by-default-lint.stderr @@ -0,0 +1,14 @@ +warning: any use of this value will cause an error + --> $DIR/force-deny-by-default-lint.rs:4:16 + | +LL | const C: i32 = 1 / 0; + | ---------------^^^^^- + | | + | attempt to divide `1_i32` by zero + | + = note: Warning forced by `force-warns` commandline option + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 + +warning: 1 warning emitted + From ab419314e95b26d6e8662f896508b5efe3fcc3a3 Mon Sep 17 00:00:00 2001 From: Ryan Levick Date: Wed, 2 Jun 2021 18:07:39 +0200 Subject: [PATCH 7/9] Add a page on force-warns in unstable book --- compiler/rustc_middle/src/lint.rs | 2 +- .../src/compiler-flags/force-warns.md | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/doc/unstable-book/src/compiler-flags/force-warns.md diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs index 85080354e4d72..4c7ea937ceb7d 100644 --- a/compiler/rustc_middle/src/lint.rs +++ b/compiler/rustc_middle/src/lint.rs @@ -365,7 +365,7 @@ pub fn struct_lint_level<'s, 'd>( sess.diag_note_once( &mut err, DiagnosticMessageId::from(lint), - "Warning forced by `force-warns` commandline option", + "warning forced by `force-warns` commandline option", ); } } diff --git a/src/doc/unstable-book/src/compiler-flags/force-warns.md b/src/doc/unstable-book/src/compiler-flags/force-warns.md new file mode 100644 index 0000000000000..0028c25beb4ba --- /dev/null +++ b/src/doc/unstable-book/src/compiler-flags/force-warns.md @@ -0,0 +1,21 @@ +# `force-warns` + +The tracking issue for this feature is: [#85512](https://github.com/rust-lang/rust/issues/85512). + +------------------------ + +This feature allows you to cause any lint to produce a warning even if the lint has a different level by default or another level is set somewhere else. For instance, the `force-warns` option can be used to make a lint (e.g., `dead_code`) produce a warning even if that lint is allowed in code with `#![allow(dead_code)]`. + +## Example + +```rust,ignore (partial-example) +#![allow(dead_code)] + +fn dead_function() {} +// This would normally not produce a warning even though the +// function is not used, because dead code is being allowed + +fn main() {} +``` + +We can force a warning to be produced by providing `--force-warns dead_code` to rustc. From 81da9b48aafa49bcd8f9394210a58fa51460b672 Mon Sep 17 00:00:00 2001 From: Ryan Levick Date: Thu, 3 Jun 2021 10:18:38 +0200 Subject: [PATCH 8/9] Add run-make test testing flag stability --- src/doc/unstable-book/src/compiler-flags/force-warns.md | 2 +- src/test/run-make/unstable-flag-required/Makefile | 1 + src/test/run-make/unstable-flag-required/force-warns.stderr | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 src/test/run-make/unstable-flag-required/force-warns.stderr diff --git a/src/doc/unstable-book/src/compiler-flags/force-warns.md b/src/doc/unstable-book/src/compiler-flags/force-warns.md index 0028c25beb4ba..0a205be096c00 100644 --- a/src/doc/unstable-book/src/compiler-flags/force-warns.md +++ b/src/doc/unstable-book/src/compiler-flags/force-warns.md @@ -12,7 +12,7 @@ This feature allows you to cause any lint to produce a warning even if the lint #![allow(dead_code)] fn dead_function() {} -// This would normally not produce a warning even though the +// This would normally not produce a warning even though the // function is not used, because dead code is being allowed fn main() {} diff --git a/src/test/run-make/unstable-flag-required/Makefile b/src/test/run-make/unstable-flag-required/Makefile index b8769d5f69051..aa20d6aa4bf27 100644 --- a/src/test/run-make/unstable-flag-required/Makefile +++ b/src/test/run-make/unstable-flag-required/Makefile @@ -2,3 +2,4 @@ all: $(RUSTDOC) --output-format=json x.html 2>&1 | diff - output-format-json.stderr + $(RUSTC) --force-warns dead_code x.rs 2>&1 | diff - force-warns.stderr diff --git a/src/test/run-make/unstable-flag-required/force-warns.stderr b/src/test/run-make/unstable-flag-required/force-warns.stderr new file mode 100644 index 0000000000000..e0936196a116f --- /dev/null +++ b/src/test/run-make/unstable-flag-required/force-warns.stderr @@ -0,0 +1,2 @@ +error: the `-Z unstable-options` flag must also be passed to enable the flag `--force-warns=lints` + From 896898ed43bb776db830717755bcccc404c20277 Mon Sep 17 00:00:00 2001 From: Ryan Levick Date: Thu, 3 Jun 2021 10:39:13 +0200 Subject: [PATCH 9/9] Update tests with new casing --- .../ui/lint/force-warn/force-allowed-by-default-lint.stderr | 2 +- .../lint/force-warn/force-allowed-deny-by-default-lint.stderr | 2 +- src/test/ui/lint/force-warn/force-allowed-warning.stderr | 2 +- src/test/ui/lint/force-warn/force-deny-by-default-lint.stderr | 2 +- .../ui/lint/force-warn/force-lint-allow-all-warnings.stderr | 2 +- .../lint/force-warn/force-lint-group-allow-all-warnings.stderr | 2 +- src/test/ui/lint/force-warn/force-lint-in-allowed-group.stderr | 2 +- .../ui/lint/force-warn/force-warn-group-allow-warning.stderr | 2 +- src/test/ui/lint/force-warn/force-warn-group.stderr | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/test/ui/lint/force-warn/force-allowed-by-default-lint.stderr b/src/test/ui/lint/force-warn/force-allowed-by-default-lint.stderr index 24ccfe6107738..0e0e934c7655f 100644 --- a/src/test/ui/lint/force-warn/force-allowed-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/force-allowed-by-default-lint.stderr @@ -4,7 +4,7 @@ warning: hidden lifetime parameters in types are deprecated LL | fn foo(x: &Foo) {} | ^^^- help: indicate the anonymous lifetime: `<'_>` | - = note: Warning forced by `force-warns` commandline option + = note: warning forced by `force-warns` commandline option warning: 1 warning emitted diff --git a/src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.stderr b/src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.stderr index abaf424e532d3..bad12f94b1805 100644 --- a/src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.stderr @@ -6,7 +6,7 @@ LL | const C: i32 = 1 / 0; | | | attempt to divide `1_i32` by zero | - = note: Warning forced by `force-warns` commandline option + = note: warning forced by `force-warns` commandline option = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 diff --git a/src/test/ui/lint/force-warn/force-allowed-warning.stderr b/src/test/ui/lint/force-warn/force-allowed-warning.stderr index 9ae32e89a98d2..145798a32a9ef 100644 --- a/src/test/ui/lint/force-warn/force-allowed-warning.stderr +++ b/src/test/ui/lint/force-warn/force-allowed-warning.stderr @@ -4,7 +4,7 @@ warning: function is never used: `dead_function` LL | fn dead_function() {} | ^^^^^^^^^^^^^ | - = note: Warning forced by `force-warns` commandline option + = note: warning forced by `force-warns` commandline option warning: 1 warning emitted diff --git a/src/test/ui/lint/force-warn/force-deny-by-default-lint.stderr b/src/test/ui/lint/force-warn/force-deny-by-default-lint.stderr index a1905034f5b5f..4b004cf367d94 100644 --- a/src/test/ui/lint/force-warn/force-deny-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/force-deny-by-default-lint.stderr @@ -6,7 +6,7 @@ LL | const C: i32 = 1 / 0; | | | attempt to divide `1_i32` by zero | - = note: Warning forced by `force-warns` commandline option + = note: warning forced by `force-warns` commandline option = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 diff --git a/src/test/ui/lint/force-warn/force-lint-allow-all-warnings.stderr b/src/test/ui/lint/force-warn/force-lint-allow-all-warnings.stderr index dc9af8997b28f..577dbe1fea8df 100644 --- a/src/test/ui/lint/force-warn/force-lint-allow-all-warnings.stderr +++ b/src/test/ui/lint/force-warn/force-lint-allow-all-warnings.stderr @@ -4,7 +4,7 @@ warning: function is never used: `dead_function` LL | fn dead_function() {} | ^^^^^^^^^^^^^ | - = note: Warning forced by `force-warns` commandline option + = note: warning forced by `force-warns` commandline option warning: 1 warning emitted diff --git a/src/test/ui/lint/force-warn/force-lint-group-allow-all-warnings.stderr b/src/test/ui/lint/force-warn/force-lint-group-allow-all-warnings.stderr index 3965d5ca2385d..8665fa2610a3a 100644 --- a/src/test/ui/lint/force-warn/force-lint-group-allow-all-warnings.stderr +++ b/src/test/ui/lint/force-warn/force-lint-group-allow-all-warnings.stderr @@ -4,7 +4,7 @@ warning: function `FUNCTION` should have a snake case name LL | pub fn FUNCTION() {} | ^^^^^^^^ help: convert the identifier to snake case: `function` | - = note: Warning forced by `force-warns` commandline option + = note: warning forced by `force-warns` commandline option warning: 1 warning emitted diff --git a/src/test/ui/lint/force-warn/force-lint-in-allowed-group.stderr b/src/test/ui/lint/force-warn/force-lint-in-allowed-group.stderr index a28b14ebc9b11..40750ffea8c87 100644 --- a/src/test/ui/lint/force-warn/force-lint-in-allowed-group.stderr +++ b/src/test/ui/lint/force-warn/force-lint-in-allowed-group.stderr @@ -4,7 +4,7 @@ warning: trait objects without an explicit `dyn` are deprecated LL | pub fn function(_x: Box) {} | ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | - = note: Warning forced by `force-warns` commandline option + = note: warning forced by `force-warns` commandline option = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! = note: for more information, see issue #80165 diff --git a/src/test/ui/lint/force-warn/force-warn-group-allow-warning.stderr b/src/test/ui/lint/force-warn/force-warn-group-allow-warning.stderr index f57dd1e70dc0a..88ae846caa0a9 100644 --- a/src/test/ui/lint/force-warn/force-warn-group-allow-warning.stderr +++ b/src/test/ui/lint/force-warn/force-warn-group-allow-warning.stderr @@ -4,7 +4,7 @@ warning: trait objects without an explicit `dyn` are deprecated LL | pub fn function(_x: Box) {} | ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | - = note: Warning forced by `force-warns` commandline option + = note: warning forced by `force-warns` commandline option = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! = note: for more information, see issue #80165 diff --git a/src/test/ui/lint/force-warn/force-warn-group.stderr b/src/test/ui/lint/force-warn/force-warn-group.stderr index f2b0ce04b541b..f808727991ed4 100644 --- a/src/test/ui/lint/force-warn/force-warn-group.stderr +++ b/src/test/ui/lint/force-warn/force-warn-group.stderr @@ -4,7 +4,7 @@ warning: trait objects without an explicit `dyn` are deprecated LL | pub fn function(_x: Box) {} | ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | - = note: Warning forced by `force-warns` commandline option + = note: warning forced by `force-warns` commandline option = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! = note: for more information, see issue #80165