Force warn on lint groups as well

This commit is contained in:
Ryan Levick 2021-06-02 17:09:07 +02:00
parent 4675690ac4
commit 3b206b7a70
19 changed files with 114 additions and 26 deletions

View file

@ -1164,6 +1164,7 @@ 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>, Vec<String>) {
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 (lint_opts, describe_lints, lint_cap, force_warns) =
get_cmd_lint_options(matches, error_format);
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, &debugging_opts);
check_debug_option_stability(&debugging_opts, error_format, json_rendered);
if !debugging_opts.unstable_options && json_unused_externs {