Skip to content

Commit

Permalink
[cfg_match] Document the use of expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
c410-f3r committed Jan 21, 2025
1 parent 73c0ae6 commit 587b9c6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions library/core/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,17 @@ pub macro cfg_match {
/// }
/// }
/// ```
///
/// If desired, it is possible to return expressions through the use of surrounding braces:
///
/// ```
/// #![feature(cfg_match)]
///
/// let _some_string = cfg_match! {{
/// unix => { "With great power comes great electricity bills" },
/// _ => { "Behind every successful diet is an unwatched pizza" },
/// }};
/// ```
#[cfg(not(bootstrap))]
#[unstable(feature = "cfg_match", issue = "115585")]
#[rustc_diagnostic_item = "cfg_match"]
Expand Down

0 comments on commit 587b9c6

Please sign in to comment.