diff options
| author | David Freese <dvfreese@gmail.com> | 2020-04-29 11:50:23 -0700 |
|---|---|---|
| committer | David Freese <dvfreese@gmail.com> | 2020-04-29 11:50:23 -0700 |
| commit | 4813a81432da746d9094438760bcac5c161c75fe (patch) | |
| tree | b7b41abac8ba594e6580afe9ab4a68aeb7a76558 | |
| parent | 36d13cb01ba6a0a9b7c13ca2b9461a111cb3e395 (diff) | |
| download | rust-4813a81432da746d9094438760bcac5c161c75fe.tar.gz rust-4813a81432da746d9094438760bcac5c161c75fe.zip | |
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
| -rw-r--r-- | src/libcore/macros/mod.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libcore/macros/mod.rs b/src/libcore/macros/mod.rs index 18d5eaa9648..8de6be86e34 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, 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 |
