Skip to content

Commit

Permalink
Add clarification on std::cfg macro docs v. #[cfg] attribute
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dfreese committed Apr 29, 2020
1 parent 36d13cb commit 4813a81
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/libcore/macros/mod.rs
Expand Up @@ -1159,6 +1159,10 @@ pub(crate) mod builtin {
/// The syntax given to this macro is the same syntax as the [`cfg`]
/// attribute.
///
/// `cfg!`, unlike `#[cfg]`, does not remove any code and only evaluates to true or false. For
/// example, this means all code in an if/else block needs to be valid when `cfg!` is used for
/// the condition, regardless of what `cfg!` is evaluating.
///
/// [`cfg`]: ../reference/conditional-compilation.html#the-cfg-attribute
///
/// # Examples
Expand Down

0 comments on commit 4813a81

Please sign in to comment.