File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -196,16 +196,14 @@ pub macro assert_matches {
196
196
} ,
197
197
}
198
198
199
- /// A macro for defining `#[ cfg]` match-like statements .
199
+ /// Selects code at compile-time based on ` cfg` predicates .
200
200
///
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
+ /// This macro evaluates, at compile-time, a series of `cfg` predicates,
202
+ /// selects the first that is true, and emits the code guarded by that
203
+ /// predicate. The code guarded by other predicates is not emitted.
203
204
///
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.
205
+ /// An optional trailing `_` wildcard can be used to specify a fallback. If
206
+ /// none of the predicates are true, a [ `compile_error`] is emitted.
209
207
///
210
208
/// # Example
211
209
///
@@ -225,7 +223,7 @@ pub macro assert_matches {
225
223
/// }
226
224
/// ```
227
225
///
228
- /// If desired, it is possible to return expressions through the use of surrounding braces :
226
+ /// The `cfg_select!` macro can also be used in expression position :
229
227
///
230
228
/// ```
231
229
/// #![feature(cfg_select)]
You can’t perform that action at this time.
0 commit comments