@@ -1164,6 +1164,7 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
11641164pub fn get_cmd_lint_options (
11651165 matches : & getopts:: Matches ,
11661166 error_format : ErrorOutputType ,
1167+ debugging_opts : & DebuggingOptions ,
11671168) -> ( Vec < ( String , lint:: Level ) > , bool , Option < lint:: Level > , Vec < String > ) {
11681169 let mut lint_opts_with_position = vec ! [ ] ;
11691170 let mut describe_lints = false ;
@@ -1198,6 +1199,14 @@ pub fn get_cmd_lint_options(
11981199 . unwrap_or_else ( || early_error ( error_format, & format ! ( "unknown lint level: `{}`" , cap) ) )
11991200 } ) ;
12001201
1202+ if !debugging_opts. unstable_options && matches. opt_present ( "force-warns" ) {
1203+ early_error (
1204+ error_format,
1205+ "the `-Z unstable-options` flag must also be passed to enable \
1206+ the flag `--force-warns=lints`",
1207+ ) ;
1208+ }
1209+
12011210 let force_warns = matches. opt_strs ( "force-warns" ) ;
12021211
12031212 ( lint_opts, describe_lints, lint_cap, force_warns)
@@ -1937,10 +1946,10 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
19371946 let crate_types = parse_crate_types_from_list ( unparsed_crate_types)
19381947 . unwrap_or_else ( |e| early_error ( error_format, & e[ ..] ) ) ;
19391948
1949+ let mut debugging_opts = DebuggingOptions :: build ( matches, error_format) ;
19401950 let ( lint_opts, describe_lints, lint_cap, force_warns) =
1941- get_cmd_lint_options ( matches, error_format) ;
1951+ get_cmd_lint_options ( matches, error_format, & debugging_opts ) ;
19421952
1943- let mut debugging_opts = DebuggingOptions :: build ( matches, error_format) ;
19441953 check_debug_option_stability ( & debugging_opts, error_format, json_rendered) ;
19451954
19461955 if !debugging_opts. unstable_options && json_unused_externs {
0 commit comments