Skip to content

Commit c7eb5ad

Browse files
committed
Reorganize conventions
This changes the conventions chapter to use sections instead of a list. It also rearranges the order into something that for whatever reason seems a little more logical to me.
1 parent 9743740 commit c7eb5ad

File tree

2 files changed

+54
-35
lines changed

2 files changed

+54
-35
lines changed

src/conventions.md

Lines changed: 54 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,76 @@
44

55
Like all technical books, this book has certain conventions in how it displays information. These conventions are documented here.
66

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
88

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 `[*]`.
1011

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.
1213

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.
1516
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
1718

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].
2020

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.
2222

23-
> [!EXAMPLE]
24-
> This is a code example.
25-
> ```rust
26-
> println!("hello world");
27-
> ```
23+
## Definitions
2824

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.
3026

31-
> [!WARNING]
32-
> This is an example warning.
27+
An *example term* is an example of a term being defined.
3328

34-
* Code snippets inline in the text are inside `<code>` tags.
29+
## Examples
3530

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.
3732

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+
> ```
4438
45-
All examples are written for the latest edition unless otherwise stated.
39+
## Code blocks
4640
47-
* The grammar and lexical productions are described in the [Notation] chapter.
41+
Code snippets inline in the text are inside `<code>` tags.
4842
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.
5171
52-
The rule name can be clicked to link to that rule.
72+
## Editions
5373

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:
5675

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.
5878
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

src/introduction.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ You can contribute to this book by opening an issue or sending a pull request to
5959
[github issues]: https://github.com/rust-lang/reference/issues
6060
[lifetime of temporaries]: expressions.html#temporaries
6161
[linkage]: linkage.html
62-
[Notation]: notation.md
6362
[rustc book]: ../rustc/index.html
6463
[scope chapter]: scope.md
6564
[standard library]: std

0 commit comments

Comments
 (0)