|
4 | 4 |
|
5 | 5 | Like all technical books, this book has certain conventions in how it displays information. These conventions are documented here. |
6 | 6 |
|
7 | | -* Statements that define a term contain that term in *italics*. Whenever that term is used outside of that chapter, it is usually a link to the section that has this definition. |
| 7 | +## Rules |
8 | 8 |
|
9 | | - An *example term* is an example of a term being defined. |
| 9 | +r[example.rule.label] |
| 10 | +Rule identifiers appear before each language rule enclosed in square brackets. These identifiers provide a way to refer to and link to a specific rule in the language ([e.g.][example rule]). The rule identifier uses periods to separate sections from most general to most specific ([destructors.scope.nesting.function-body] for example). On narrow screens, the rule name will collapse to display `[*]`. |
10 | 11 |
|
11 | | -* The main text describes the latest stable edition. Differences to previous editions are separated in edition blocks: |
| 12 | +The rule name can be clicked to link to that rule. |
12 | 13 |
|
13 | | - > [!EDITION-2018] |
14 | | - > Before the 2018 edition, the behavior was this. As of the 2018 edition, the behavior is that. |
| 14 | +> [!WARNING] |
| 15 | +> The organization of the rules is currently in flux. For the time being, these identifier names are not stable between releases, and links to these rules may fail if they are changed. We intend to stabilize these once the organization has settled so that links to the rule names will not break between releases. |
15 | 16 |
|
16 | | -* Notes that contain useful information about the state of the book or point out useful, but mostly out of scope, information are in note blocks. |
| 17 | +### Rule tests |
17 | 18 |
|
18 | | - > [!NOTE] |
19 | | - > This is an example note. |
| 19 | +Rules that have associated tests will include a `Tests` link below them (on narrow screens, the link is `[T]`). Clicking the link will pop up a list of tests, which can be clicked to view the test. For example, see [input.encoding.utf8]. |
20 | 20 |
|
21 | | -* Example blocks show an example that demonstrates some rule or points out some interesting aspect. Some examples may have hidden lines which can be viewed by clicking the eye icon that appears when hovering or tapping the example. |
| 21 | +Linking rules to tests is an ongoing effort. See the [Test summary](test-summary.md) chapter for an overview. |
22 | 22 |
|
23 | | - > [!EXAMPLE] |
24 | | - > This is a code example. |
25 | | - > ```rust |
26 | | - > println!("hello world"); |
27 | | - > ``` |
| 23 | +## Definitions |
28 | 24 |
|
29 | | -* Warnings that show unsound behavior in the language or possibly confusing interactions of language features are in a special warning box. |
| 25 | +Statements that define a term contain that term in *italics*. Whenever that term is used outside of that chapter, it is usually a link to the section that has this definition. |
30 | 26 |
|
31 | | - > [!WARNING] |
32 | | - > This is an example warning. |
| 27 | +An *example term* is an example of a term being defined. |
33 | 28 |
|
34 | | -* Code snippets inline in the text are inside `<code>` tags. |
| 29 | +## Examples |
35 | 30 |
|
36 | | - Longer code examples are in a syntax highlighted box that has controls for copying, executing, and showing hidden lines in the top right corner. |
| 31 | +Example blocks show an example that demonstrates some rule or points out some interesting aspect. Some examples may have hidden lines which can be viewed by clicking the eye icon that appears when hovering or tapping the example. |
37 | 32 |
|
38 | | - ```rust |
39 | | - # // This is a hidden line. |
40 | | - fn main() { |
41 | | - println!("This is a code example"); |
42 | | - } |
43 | | - ``` |
| 33 | +> [!EXAMPLE] |
| 34 | +> This is a code example. |
| 35 | +> ```rust |
| 36 | +> println!("hello world"); |
| 37 | +> ``` |
44 | 38 |
|
45 | | - All examples are written for the latest edition unless otherwise stated. |
| 39 | +## Code blocks |
46 | 40 |
|
47 | | -* The grammar and lexical productions are described in the [Notation] chapter. |
| 41 | +Code snippets inline in the text are inside `<code>` tags. |
48 | 42 |
|
49 | | -r[example.rule.label] |
50 | | -* Rule identifiers appear before each language rule enclosed in square brackets. These identifiers provide a way to refer to and link to a specific rule in the language ([e.g.][example rule]). The rule identifier uses periods to separate sections from most general to most specific ([destructors.scope.nesting.function-body] for example). On narrow screens, the rule name will collapse to display `[*]`. |
| 43 | +Longer code examples are in a syntax highlighted box that has controls for copying, executing, and showing hidden lines in the top right corner. |
| 44 | +
|
| 45 | +```rust |
| 46 | +# // This is a hidden line. |
| 47 | +fn main() { |
| 48 | + println!("This is a code example"); |
| 49 | +} |
| 50 | +``` |
| 51 | +
|
| 52 | +All examples are written for the latest edition unless otherwise stated. |
| 53 | + |
| 54 | +## Grammar |
| 55 | + |
| 56 | +The grammar and lexical productions are described in the [Notation] chapter. |
| 57 | + |
| 58 | +## Notes |
| 59 | + |
| 60 | +Notes that contain useful information about the state of the book or point out useful, but mostly out of scope, information are in note blocks. |
| 61 | + |
| 62 | +> [!NOTE] |
| 63 | +> This is an example note. |
| 64 | +
|
| 65 | +## Warnings |
| 66 | + |
| 67 | +Warnings that show unsound behavior in the language or possibly confusing interactions of language features are in a special warning box. |
| 68 | + |
| 69 | +> [!WARNING] |
| 70 | +> This is an example warning. |
51 | 71 |
|
52 | | - The rule name can be clicked to link to that rule. |
| 72 | +## Editions |
53 | 73 |
|
54 | | - > [!WARNING] |
55 | | - > The organization of the rules is currently in flux. For the time being, these identifier names are not stable between releases, and links to these rules may fail if they are changed. We intend to stabilize these once the organization has settled so that links to the rule names will not break between releases. |
| 74 | +The main text describes the latest stable edition. Differences to previous editions are separated in edition blocks: |
56 | 75 |
|
57 | | -* Rules that have associated tests will include a `Tests` link below them (on narrow screens, the link is `[T]`). Clicking the link will pop up a list of tests, which can be clicked to view the test. For example, see [input.encoding.utf8]. |
| 76 | +> [!EDITION-2018] |
| 77 | +> Before the 2018 edition, the behavior was this. As of the 2018 edition, the behavior is that. |
58 | 78 |
|
59 | | - Linking rules to tests is an ongoing effort. See the [Test summary](test-summary.md) chapter for an overview. |
| 79 | +[example rule]: example.rule.label |
0 commit comments