Skip to content

Commit 68327f8

Browse files
committed
add deprecated and do nothing flag to options table
1 parent 7270e73 commit 68327f8

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

compiler/rustc_driver_impl/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,11 +1158,12 @@ fn describe_codegen_flags() {
11581158

11591159
fn print_flag_list<T>(
11601160
cmdline_opt: &str,
1161-
flag_list: &[(&'static str, T, &'static str, &'static str)],
1161+
flag_list: &[(&'static str, T, &'static str, &'static str, bool)],
11621162
) {
1163-
let max_len = flag_list.iter().map(|&(name, _, _, _)| name.chars().count()).max().unwrap_or(0);
1163+
let max_len =
1164+
flag_list.iter().map(|&(name, _, _, _, _)| name.chars().count()).max().unwrap_or(0);
11641165

1165-
for &(name, _, _, desc) in flag_list {
1166+
for &(name, _, _, desc, _) in flag_list {
11661167
safe_println!(
11671168
" {} {:>width$}=val -- {}",
11681169
cmdline_opt,

compiler/rustc_session/src/options.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ macro_rules! options {
239239
$init:expr,
240240
$parse:ident,
241241
[$dep_tracking_marker:ident],
242-
$desc:expr)
242+
$desc:expr
243+
$(, deprecated_do_nothing: $dnn:literal )?)
243244
),* ,) =>
244245
(
245246
#[derive(Clone)]
@@ -280,7 +281,7 @@ macro_rules! options {
280281
}
281282

282283
pub const $stat: OptionDescrs<$struct_name> =
283-
&[ $( (stringify!($opt), $optmod::$opt, desc::$parse, $desc) ),* ];
284+
&[ $( (stringify!($opt), $optmod::$opt, desc::$parse, $desc, false $( || $dnn )? ) ),* ];
284285

285286
mod $optmod {
286287
$(
@@ -315,7 +316,8 @@ macro_rules! redirect_field {
315316
}
316317

317318
type OptionSetter<O> = fn(&mut O, v: Option<&str>) -> bool;
318-
type OptionDescrs<O> = &'static [(&'static str, OptionSetter<O>, &'static str, &'static str)];
319+
type OptionDescrs<O> =
320+
&'static [(&'static str, OptionSetter<O>, &'static str, &'static str, bool)];
319321

320322
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
321323
fn build_options<O: Default>(
@@ -334,7 +336,7 @@ fn build_options<O: Default>(
334336

335337
let option_to_lookup = key.replace('-', "_");
336338
match descrs.iter().find(|(name, ..)| *name == option_to_lookup) {
337-
Some((_, setter, type_desc, _)) => {
339+
Some((_, setter, type_desc, _, _)) => {
338340
if !setter(&mut op, value) {
339341
match value {
340342
None => early_dcx.early_fatal(

0 commit comments

Comments
 (0)