diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-10-26 14:34:14 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-10-31 08:01:01 +1100 |
| commit | 531b38ac2329b8078ca925d9373a5734abea0bf1 (patch) | |
| tree | e88d03829ede84cdfefcc6784b302622a157c3ee | |
| parent | bb3e09f1444ee10c5bbbaf971eb1e6e8994cb046 (diff) | |
| download | rust-531b38ac2329b8078ca925d9373a5734abea0bf1.tar.gz rust-531b38ac2329b8078ca925d9373a5734abea0bf1.zip | |
Cover two more cases in the `gate_doc` macro.
| -rw-r--r-- | compiler/rustc_ast_passes/src/feature_gate.rs | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 6288e9f8b36..5ccdedc76ca 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -177,29 +177,25 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { // Check unstable flavors of the `#[doc]` attribute. if attr.has_name(sym::doc) { for nested_meta in attr.meta_item_list().unwrap_or_default() { - macro_rules! gate_doc { ($($name:ident => $feature:ident)*) => { - $(if nested_meta.has_name(sym::$name) { - let msg = concat!("`#[doc(", stringify!($name), ")]` is experimental"); + macro_rules! gate_doc { ($($s:literal { $($name:ident => $feature:ident)* })*) => { + $($(if nested_meta.has_name(sym::$name) { + let msg = concat!("`#[doc(", stringify!($name), ")]` is ", $s); gate_feature_post!(self, $feature, attr.span, msg); - })* + })*)* }} gate_doc!( - cfg => doc_cfg - cfg_hide => doc_cfg_hide - masked => doc_masked - notable_trait => doc_notable_trait + "experimental" { + cfg => doc_cfg + cfg_hide => doc_cfg_hide + masked => doc_masked + notable_trait => doc_notable_trait + } + "meant for internal use only" { + keyword => rustdoc_internals + fake_variadic => rustdoc_internals + } ); - - if nested_meta.has_name(sym::keyword) { - let msg = "`#[doc(keyword)]` is meant for internal use only"; - gate_feature_post!(self, rustdoc_internals, attr.span, msg); - } - - if nested_meta.has_name(sym::fake_variadic) { - let msg = "`#[doc(fake_variadic)]` is meant for internal use only"; - gate_feature_post!(self, rustdoc_internals, attr.span, msg); - } } } if !attr.is_doc_comment() |
