Skip to content

Commit 7d9fe91

Browse files
committed
[cfg_match] Document the use of expressions
1 parent 73c0ae6 commit 7d9fe91

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

library/core/src/macros/mod.rs

+11
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,17 @@ pub macro cfg_match {
313313
/// }
314314
/// }
315315
/// ```
316+
///
317+
/// If desired, it is possible to return expressions through the use of surrounding braces:
318+
///
319+
/// ```
320+
/// #![feature(cfg_match)]
321+
///
322+
/// let _some_string = cfg_match! {{
323+
/// unix => { "With great power comes great electricity bills" }
324+
/// _ => { "Behind every successful diet is an unwatched pizza" }
325+
/// }};
326+
/// ```
316327
#[cfg(not(bootstrap))]
317328
#[unstable(feature = "cfg_match", issue = "115585")]
318329
#[rustc_diagnostic_item = "cfg_match"]

0 commit comments

Comments
 (0)