File tree Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -198,14 +198,11 @@ pub macro assert_matches {
198198
199199/// A macro for defining `#[cfg]` match-like statements.
200200 ///
201- /// It is similar to the `if/elif` C preprocessor macro by allowing definition of a cascade of
202- /// `# [ cfg ] ` cases , emitting the implementation which matches first .
201+ /// The `cfg_select!` macro checks a series of `#[cfg]` conditions, and picks the branch that
202+ /// belongs to the first condition that evaluates to true .
203203///
204- /// This allows you to conveniently provide a long list `#[cfg]`'d blocks of code
205- /// without having to rewrite each clause multiple times.
206- ///
207- /// Trailing `_` wildcard match arms are **optional** and they indicate a fallback branch when
208- /// all previous declarations do not evaluate to true.
204+ /// An optional trailing `_` wildcard match arm can be used to specify a fallback branch.
205+ /// If none of the conditions evaluate to `true`, a compile error is emitted.
209206 ///
210207/// # Example
211208 ///
@@ -225,7 +222,7 @@ pub macro assert_matches {
225222/// }
226223/// ```
227224///
228- /// If desired, it is possible to return expressions through the use of surrounding braces :
225+ /// The `cfg_select!` macro can also be used in expression position :
229226///
230227/// ```
231228/// #![feature(cfg_select)]
Original file line number Diff line number Diff line change @@ -25,3 +25,6 @@ cfg_select! {
2525 //~^ ERROR none of the rules in this `cfg_select` evaluated to true
2626 false => { }
2727}
28+
29+ cfg_select ! { }
30+ //~^ ERROR none of the rules in this `cfg_select` evaluated to true
Original file line number Diff line number Diff line change @@ -21,5 +21,11 @@ LL | | false => {}
2121LL | | }
2222 | |_^
2323
24- error: aborting due to 2 previous errors; 1 warning emitted
24+ error: none of the rules in this `cfg_select` evaluated to true
25+ --> $DIR/cfg_select.rs:29:1
26+ |
27+ LL | cfg_select! {}
28+ | ^^^^^^^^^^^^^^
29+
30+ error: aborting due to 3 previous errors; 1 warning emitted
2531
You can’t perform that action at this time.
0 commit comments