diff options
| author | Jakub Beránek <berykubik@gmail.com> | 2025-08-14 21:48:42 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-14 21:48:42 +0200 |
| commit | 01bd889098a6d9f7125bf4643d60ce9b95c8edf6 (patch) | |
| tree | e223edd3f8cb1408e1ff4e0a53e8e3562ca6e6fc /library | |
| parent | fadd083512ce90d359a4ee07a8454a69c5538527 (diff) | |
| parent | 38df15805ba5be78d70c515f1d585ee6be95e13b (diff) | |
| download | rust-01bd889098a6d9f7125bf4643d60ce9b95c8edf6.tar.gz rust-01bd889098a6d9f7125bf4643d60ce9b95c8edf6.zip | |
Rollup merge of #145233 - joshtriplett:cfg-select-expr, r=jieyouxu
cfg_select: Support unbraced expressions Tracking issue for `cfg_select`: rust-lang/rust#115585 When operating on expressions, `cfg_select!` can now handle expressions without braces. (It still requires braces for other things, such as items.) Expand the test coverage and documentation accordingly. --- I'm not sure whether deciding to extend `cfg_select!` in this way is T-lang or T-libs-api. I've labeled for both, with the request that both teams don't block on each other. :)
Diffstat (limited to 'library')
| -rw-r--r-- | library/core/src/macros/mod.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index c59290a757b..db8b527d593 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -223,13 +223,14 @@ pub macro assert_matches { /// } /// ``` /// -/// The `cfg_select!` macro can also be used in expression position: +/// The `cfg_select!` macro can also be used in expression position, with or without braces on the +/// right-hand side: /// /// ``` /// #![feature(cfg_select)] /// /// let _some_string = cfg_select! { -/// unix => { "With great power comes great electricity bills" } +/// unix => "With great power comes great electricity bills", /// _ => { "Behind every successful diet is an unwatched pizza" } /// }; /// ``` |
