Skip to content

Commit 4813a81

Browse files
committed
Add clarification on std::cfg macro docs v. #[cfg] attribute
The wording was discussed, to a limited degree in #71679. This tries to address some confusion I as well as someone else had independently when looking at this macro. Fixes #71679
1 parent 36d13cb commit 4813a81

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, this means all code in an if/else block needs 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)