Reference audit: comments and whitespace sections
This commit is contained in:
parent
85ee89ae70
commit
0ea193def9
1 changed files with 12 additions and 9 deletions
|
|
@ -83,29 +83,32 @@ that does _not_ occur in the set of [keywords](#keywords).
|
|||
|
||||
## Comments
|
||||
|
||||
Comments in Rust code follow the general C++ style of line and block-comment
|
||||
forms. Nested block comments are supported.
|
||||
Comments in Rust code follow the general C++ style of line (`//`) and
|
||||
block-comment (`/* ... */`) forms. Nested block comments are supported.
|
||||
|
||||
Line comments beginning with exactly _three_ slashes (`///`), and block
|
||||
comments beginning with exactly one repeated asterisk in the block-open
|
||||
sequence (`/**`), are interpreted as a special syntax for `doc`
|
||||
[attributes](#attributes). That is, they are equivalent to writing
|
||||
`#[doc="..."]` around the body of the comment (this includes the comment
|
||||
characters themselves, i.e. `/// Foo` turns into `#[doc="/// Foo"]`).
|
||||
`#[doc="..."]` around the body of the comment, i.e., `/// Foo` turns into
|
||||
`#[doc="Foo"]`.
|
||||
|
||||
Line comments beginning with `//!` and block comments beginning with `/*!` are
|
||||
doc comments that apply to the parent of the comment, rather than the item
|
||||
that follows. That is, they are equivalent to writing `#![doc="..."]` around
|
||||
the body of the comment. `//!` comments are usually used to display
|
||||
information on the crate index page.
|
||||
the body of the comment. `//!` comments are usually used to document
|
||||
modules that occupy a source file.
|
||||
|
||||
Non-doc comments are interpreted as a form of whitespace.
|
||||
|
||||
## Whitespace
|
||||
|
||||
The `whitespace_char` production is any nonempty Unicode string consisting of
|
||||
any of the following Unicode characters: `U+0020` (space, `' '`), `U+0009`
|
||||
(tab, `'\t'`), `U+000A` (LF, `'\n'`), `U+000D` (CR, `'\r'`).
|
||||
Whitespace is any non-empty string containing any the following characters:
|
||||
|
||||
- `U+0020` (space, `' '`)
|
||||
- `U+0009` (tab, `'\t'`)
|
||||
- `U+000A` (LF, `'\n'`)
|
||||
- `U+000D` (CR, `'\r'`)
|
||||
|
||||
Rust is a "free-form" language, meaning that all forms of whitespace serve only
|
||||
to separate _tokens_ in the grammar, and have no semantic significance.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue