diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 836f7d1cb456..e8681237a03d 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -604,6 +604,10 @@ pub fn is_target_modifier(flag_name: &str) -> bool { /// necessary code. The main gotcha of this macro is the `cgsetters` module which is a bunch of /// generated code to parse an option into its respective field in the struct. There are a few /// hand-written parsers for parsing specific types of values in this module. +/// +/// Note: this macro's invocation is also parsed by a `syn`-based parser in +/// `src/tools/unstable-book-gen/src/main.rs` to extract unstable option names and descriptions. +/// If the format of this macro changes, that parser may need to be updated as well. macro_rules! options { ($struct_name:ident, $tmod_enum_name:ident, $stat:ident, $optmod:ident, $prefix:expr, $outputname:expr, $($( #[$attr:meta] )* $opt:ident : $t:ty = ( diff --git a/src/tools/unstable-book-gen/src/main.rs b/src/tools/unstable-book-gen/src/main.rs index 8985072cbd27..21d4da46bef5 100644 --- a/src/tools/unstable-book-gen/src/main.rs +++ b/src/tools/unstable-book-gen/src/main.rs @@ -158,7 +158,7 @@ fn parse(input: ParseStream<'_>) -> syn::Result { return Err(syn::Error::new( name.span(), format!( - "unexpected field count for option `{name}`: expected 4 or 5, found {}", + "unexpected field count for option `{name}`: expected {REQUIRED_FIELDS} or {OPTIONAL_FIELDS}, found {}", tuple_fields.len() ), ));