Skip to content

Commit 531b38a

Browse files
committed
Cover two more cases in the gate_doc macro.
1 parent bb3e09f commit 531b38a

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -177,29 +177,25 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
177177
// Check unstable flavors of the `#[doc]` attribute.
178178
if attr.has_name(sym::doc) {
179179
for nested_meta in attr.meta_item_list().unwrap_or_default() {
180-
macro_rules! gate_doc { ($($name:ident => $feature:ident)*) => {
181-
$(if nested_meta.has_name(sym::$name) {
182-
let msg = concat!("`#[doc(", stringify!($name), ")]` is experimental");
180+
macro_rules! gate_doc { ($($s:literal { $($name:ident => $feature:ident)* })*) => {
181+
$($(if nested_meta.has_name(sym::$name) {
182+
let msg = concat!("`#[doc(", stringify!($name), ")]` is ", $s);
183183
gate_feature_post!(self, $feature, attr.span, msg);
184-
})*
184+
})*)*
185185
}}
186186

187187
gate_doc!(
188-
cfg => doc_cfg
189-
cfg_hide => doc_cfg_hide
190-
masked => doc_masked
191-
notable_trait => doc_notable_trait
188+
"experimental" {
189+
cfg => doc_cfg
190+
cfg_hide => doc_cfg_hide
191+
masked => doc_masked
192+
notable_trait => doc_notable_trait
193+
}
194+
"meant for internal use only" {
195+
keyword => rustdoc_internals
196+
fake_variadic => rustdoc_internals
197+
}
192198
);
193-
194-
if nested_meta.has_name(sym::keyword) {
195-
let msg = "`#[doc(keyword)]` is meant for internal use only";
196-
gate_feature_post!(self, rustdoc_internals, attr.span, msg);
197-
}
198-
199-
if nested_meta.has_name(sym::fake_variadic) {
200-
let msg = "`#[doc(fake_variadic)]` is meant for internal use only";
201-
gate_feature_post!(self, rustdoc_internals, attr.span, msg);
202-
}
203199
}
204200
}
205201
if !attr.is_doc_comment()

0 commit comments

Comments
 (0)