Stabilize force-warn

This commit is contained in:
inquisitivecrystal 2021-07-24 00:05:24 -07:00 committed by Mark Rousskov
parent d89b4a705c
commit aee2c30f69
3 changed files with 3 additions and 14 deletions

View file

@ -1157,19 +1157,10 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
pub fn get_cmd_lint_options(
matches: &getopts::Matches,
error_format: ErrorOutputType,
debugging_opts: &DebuggingOptions,
) -> (Vec<(String, lint::Level)>, bool, Option<lint::Level>) {
let mut lint_opts_with_position = vec![];
let mut describe_lints = false;
if !debugging_opts.unstable_options && matches.opt_present("force-warn") {
early_error(
error_format,
"the `-Z unstable-options` flag must also be passed to enable \
the flag `--force-warn=lints`",
);
}
for level in [lint::Allow, lint::Warn, lint::ForceWarn, lint::Deny, lint::Forbid] {
for (arg_pos, lint_name) in matches.opt_strs_pos(level.as_str()) {
if lint_name == "help" {
@ -1959,8 +1950,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
.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) =
get_cmd_lint_options(matches, error_format, &debugging_opts);
let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format);
check_debug_option_stability(&debugging_opts, error_format, json_rendered);

View file

@ -671,8 +671,7 @@ impl Options {
return Err(1);
}
let (lint_opts, describe_lints, lint_cap) =
get_cmd_lint_options(matches, error_format, &debugging_opts);
let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format);
Ok(Options {
input,

View file

@ -505,7 +505,7 @@ fn opts() -> Vec<RustcOptGroup> {
}),
stable("allow", |o| o.optmulti("A", "allow", "Set lint allowed", "LINT")),
stable("warn", |o| o.optmulti("W", "warn", "Set lint warnings", "LINT")),
unstable("force-warn", |o| o.optmulti("", "force-warn", "Set lint force-warn", "LINT")),
stable("force-warn", |o| o.optmulti("", "force-warn", "Set lint force-warn", "LINT")),
stable("deny", |o| o.optmulti("D", "deny", "Set lint denied", "LINT")),
stable("forbid", |o| o.optmulti("F", "forbid", "Set lint forbidden", "LINT")),
stable("cap-lints", |o| {