about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-04-30 14:07:58 +0200
committerGitHub <noreply@github.com>2020-04-30 14:07:58 +0200
commit8f6eabfbaee893af88dde33294d7cc34ab2dd81a (patch)
tree216670c2abbdba8738794745427cde400d4c0e6b /src
parente2333a974a569a2db40d23876eda060037a3e942 (diff)
parent610f94423100b9ec6b5190032c9e213af5c099de (diff)
downloadrust-8f6eabfbaee893af88dde33294d7cc34ab2dd81a.tar.gz
rust-8f6eabfbaee893af88dde33294d7cc34ab2dd81a.zip
Rollup merge of #71692 - dfreese:cfgdocs, r=kennytm
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
Diffstat (limited to 'src')
-rw-r--r--src/libcore/macros/mod.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libcore/macros/mod.rs b/src/libcore/macros/mod.rs
index 18d5eaa9648..14bfa8bab89 100644
--- a/src/libcore/macros/mod.rs
+++ b/src/libcore/macros/mod.rs
@@ -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, all blocks in an if/else expression need 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