Skip to content

Commit 8f6eabf

Browse files
authored
Rollup merge of rust-lang#71692 - dfreese:cfgdocs, r=kennytm
Add clarification on std::cfg macro docs v. #[cfg] attribute The wording was discussed, to a limited degree in rust-lang#71679. This tries to address some confusion I as well as someone else had independently when looking at this macro. Fixes rust-lang#71679
2 parents e2333a9 + 610f944 commit 8f6eabf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/libcore/macros/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,10 @@ pub(crate) mod builtin {
11591159
/// The syntax given to this macro is the same syntax as the [`cfg`]
11601160
/// attribute.
11611161
///
1162+
/// `cfg!`, unlike `#[cfg]`, does not remove any code and only evaluates to true or false. For
1163+
/// example, all blocks in an if/else expression need to be valid when `cfg!` is used for
1164+
/// the condition, regardless of what `cfg!` is evaluating.
1165+
///
11621166
/// [`cfg`]: ../reference/conditional-compilation.html#the-cfg-attribute
11631167
///
11641168
/// # Examples

0 commit comments

Comments
 (0)