Skip to content

Commit 7269f0e

Browse files
committed
Auto merge of #30080 - durka:patch-10, r=alexcrichton
Fixes #30073. The input to `cfg!` is a meta attribute, but not _any_ meta attribute (e.g. `cfg!(allow(dead_code))` doesn't compile). But the macro_rules syntax can't quite express this, so I added a note to the doc.
2 parents 7fa4d99 + f18bfb3 commit 7269f0e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libstd/macros.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,8 @@ pub mod builtin {
472472
/// boolean expression evaluation of configuration flags. This frequently
473473
/// leads to less duplicated code.
474474
///
475-
/// The syntax given to this macro is the same syntax as the `cfg`
476-
/// attribute.
475+
/// The syntax given to this macro is the same syntax as [the `cfg`
476+
/// attribute](../reference.html#conditional-compilation).
477477
///
478478
/// # Examples
479479
///
@@ -486,7 +486,7 @@ pub mod builtin {
486486
/// ```
487487
#[stable(feature = "rust1", since = "1.0.0")]
488488
#[macro_export]
489-
macro_rules! cfg { ($cfg:tt) => ({ /* compiler built-in */ }) }
489+
macro_rules! cfg { ($($cfg:tt)*) => ({ /* compiler built-in */ }) }
490490

491491
/// Parse the current given file as an expression.
492492
///
@@ -501,5 +501,5 @@ pub mod builtin {
501501
/// ```
502502
#[stable(feature = "rust1", since = "1.0.0")]
503503
#[macro_export]
504-
macro_rules! include { ($cfg:tt) => ({ /* compiler built-in */ }) }
504+
macro_rules! include { ($file:expr) => ({ /* compiler built-in */ }) }
505505
}

0 commit comments

Comments
 (0)