Skip to content
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

Add documentation for conditional compilation #12220

Closed
wants to merge 1 commit into from

Conversation

tbu-
Copy link
Contributor

@tbu- tbu- commented Feb 13, 2014

Add documentation for conditional compilation

This documents in-source conditions using #[cfg(...)] and configurations
pre-defined by the compiler.

Fix #7962.

* The `deriving` attribute, for automatically generating
implementations of certain traits.
* The `deriving` attribute, for automatically generating implementations of
* certain traits.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra asterisk

@alexcrichton
Copy link
Member

Thanks for doing this! I'm glad that these attributes are finally getting some documentation :)

@huonw
Copy link
Member

huonw commented Feb 13, 2014

FWIW, I don't think the current form of #[cfg] is the desired final verson: #2119

I don't think that should stop us from adding these docs though.

This documents in-source conditions using #[cfg(...)] and configurations
pre-defined by the compiler.

Fix rust-lang#7962.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 25, 2022
…arzg

Fix `character` semantic token type definition

The semantic token type for character literals is called `character`:

https://github.com/rust-lang/rust-analyzer/blob/94fa8a6534cf93276ad7e205026402f24d41a0b2/crates/rust-analyzer/src/semantic_tokens.rs#L51

and yet the definition in `package.json` uses `char`. In practice this means trying to highlight `char` doesn’t have any effect, while `character` doesn’t have any hover documentation and doesn’t appear in autocomplete. The definition also defines the fallback semantic token type as `type`; luckily since it currently references the non-existent `char` this doesn’t have any effect, since it doesn’t really make sense to highlight character literals as types.

This PR fixes the definition in `package.json` to correctly reference `character`, and also defines the fallback type as `number`. I’d say character literals are closer to a shorthand for writing a number than a string, though this is debatable and I’d be happy to change it to `string`, or anything else.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document attributes cfg family
4 participants