diff options
| author | Folkert de Vries <folkert@folkertdev.nl> | 2025-07-04 23:56:16 +0200 |
|---|---|---|
| committer | Folkert de Vries <folkert@folkertdev.nl> | 2025-07-13 14:34:40 +0200 |
| commit | 3689b80b75bb400e740897ec83e64be332098c0d (patch) | |
| tree | db23b5f9d95c0f4613ae1599111c0c7c595be85a /library/core/src/macros/mod.rs | |
| parent | 1b0bc594a75dfc1cdedc6c17052cf44de101e632 (diff) | |
| download | rust-3689b80b75bb400e740897ec83e64be332098c0d.tar.gz rust-3689b80b75bb400e740897ec83e64be332098c0d.zip | |
make `cfg_select` a builtin macro
Diffstat (limited to 'library/core/src/macros/mod.rs')
| -rw-r--r-- | library/core/src/macros/mod.rs | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index 8035dccc632..6b9cbb06435 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -230,32 +230,16 @@ pub macro assert_matches { /// ``` /// #![feature(cfg_select)] /// -/// let _some_string = cfg_select! {{ +/// let _some_string = cfg_select! { /// unix => { "With great power comes great electricity bills" } /// _ => { "Behind every successful diet is an unwatched pizza" } -/// }}; +/// }; /// ``` #[unstable(feature = "cfg_select", issue = "115585")] #[rustc_diagnostic_item = "cfg_select"] -#[rustc_macro_transparency = "semitransparent"] -pub macro cfg_select { - ({ $($tt:tt)* }) => {{ - $crate::cfg_select! { $($tt)* } - }}, - (_ => { $($output:tt)* }) => { - $($output)* - }, - ( - $cfg:meta => $output:tt - $($( $rest:tt )+)? - ) => { - #[cfg($cfg)] - $crate::cfg_select! { _ => $output } - $( - #[cfg(not($cfg))] - $crate::cfg_select! { $($rest)+ } - )? - }, +#[rustc_builtin_macro] +pub macro cfg_select($($tt:tt)*) { + /* compiler built-in */ } /// Asserts that a boolean expression is `true` at runtime. |
