-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reference: clarify #[cfg] section #39374
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
It's still misleading, there is no "contains a string". Variables |
At least it does collapse whitespace though, so |
@bluss updated, what do you think? |
src/doc/reference.md
Outdated
|
||
one that is either defined or not | ||
(`#[cfg(foo)]`), and the other that takes on one or more string values | ||
(`#[cfg(bar = "baz")]`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better but why should we say there are two kinds of configuration options, when there is just one? first
and second="x"
are both just names of cfg
vars that can be on or off. Also some old text left in here at the end.
I think this might be a "compiler-colored glasses" kind of thing: it
certainly _feels_ like they are separate types of cfgs to the user.
…On Mon, Jan 30, 2017 at 4:49 PM, bluss ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/doc/reference.md
<#39374 (review)>:
> -(`#[cfg(foo)]`), and the other that contains a string that can be checked
-against (`#[cfg(bar = "baz")]`). Currently, only compiler-defined configuration
-options can have the latter form.
+There are two kinds of configuration options:
+
+- Boolean options, which are either on or off, e.g. `#[cfg(foo)]`. These can
+ either be defined by the compiler or specified on the command line, e.g.
+ `rustc --cfg foo`.
+- Key-value options, where a key may be associated with one or more values, e.g.
+ `#[cfg(bar = "baz")]`. These can also either be defined by the compiler or
+ specified on the command line, e.g. `rustc --cfg 'bar="baz"'` (whitespace around
+ the `=` is ignored).
+
+one that is either defined or not
+(`#[cfg(foo)]`), and the other that takes on one or more string values
+(`#[cfg(bar = "baz")]`).
better but why should we say there are two kinds of configuration options,
when there is just one? first and second="x" are both just names of cfg
vars. Also some old text left in here at the end.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#39374 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAC3nyrAtAdsVFWTMKRjrFvDpgeIHbJEks5rXlr-gaJpZM4LwoR4>
.
|
As someone who just recently realized that " Talking about associated keys seems to just confuse things. |
OK, new draft:
|
durka: r=me with that change. |
OK, done. I also added a mention of |
@bors r=steveklabnik Great! |
📌 Commit 620074d has been approved by |
reference: clarify #[cfg] section Closes rust-lang#39370, but maybe we (or clippy) should add a warning too.
reference: clarify #[cfg] section Closes rust-lang#39370, but maybe we (or clippy) should add a warning too.
Closes #39370, but maybe we (or clippy) should add a warning too.