Skip to content

Commit deff295

Browse files
committed
Apply some light edits to the rules chapter
1 parent bf0c6ec commit deff295

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
# Language rules
22

3-
Clauses within the Reference are labeled with a named *rule*. This provides the ability to link and refer to individual clauses, and to [link to the `rustc` testsuite](test-annotations.md).
3+
Clauses within the Reference are labeled with a named *rule*. This provides the ability to link and refer to individual clauses, and to [link to the `rustc` test suite](test-annotations.md).
44

55
## Rule labels
66

7-
Most clauses should be preceded with a rule label. A rule label should be on a line by itself, and should look like this:
7+
Most clauses should be preceded by a rule label. A rule label should be on a line by itself, and should look like this:
88

99
```markdown
1010
r[foo.bar]
1111
```
1212

13-
The rule name should be lowercase, with periods separating from most general to most specific (like `r[array.repeat.zero]`).
13+
The rule name should be lowercase, with periods separating components from most general to most specific (like `r[array.repeat.zero]`).
1414

15-
Rules can be linked to by their ID using markdown such as `[foo.bar]`. There are [automatic link references] so that any rule can be referred to from any page in the book.
15+
Rules can be linked to by their ID using Markdown such as `[foo.bar]`. There are [automatic link references] so that any rule can be referred to from any page in the book.
1616

17-
In the HTML, the rules are clickable just like headers.
17+
In the HTML, the rules are clickable, just like headers.
1818

1919
## Rule guidelines
2020

21-
When assigning rules to new paragraphs, or when modifying rule names, use the following guidelines:
21+
When assigning rules to new paragraphs or modifying rule names, use the following guidelines:
2222

2323
1. A rule applies to one core idea, which should be easily determined when reading the paragraph it is applied to.
24-
2. Other than the "intro" paragraph, purely explanatory, expository, or exemplary content does not need a rule. If the expository paragraph isn't directly related to the previous, separate it with a hard (rendered) line break.
24+
2. Other than the "intro" paragraph, purely explanatory, expository, or exemplary content does not need a rule. If the expository paragraph isn't directly related to the previous one, separate it with a hard (rendered) line break.
2525
- This content will be moved to `[!NOTE]` or more specific admonitions in the future.
2626
3. Rust code examples and tests do not need their own rules.
2727
4. Use the following guidelines for admonitions:
2828
- Notes: Do not include a rule.
2929
- Warning: Omit the rule if the warning follows from the previous paragraph or if the warning is explanatory and doesn't introduce any new rules.
30-
- Target specific behavior: Always include the rule.
30+
- Target-specific behavior: Always include the rule.
3131
- Edition differences: Always include the rule.
3232
5. The following keywords should be used to identify paragraphs when unambiguous:
33-
- `intro`: The beginning paragraph of each section - should explain the construct being defined overall.
33+
- `intro`: The beginning paragraph of each section. It should explain the construct being defined overall.
3434
- `syntax`: Syntax definitions or explanations when BNF syntax definitions are not used.
35-
- `namespace`: For items only, specifies the namespace(s) the item introduces a name in. May also be used elsewhere when defining a namespace (e.g. `r[attribute.diagnostic.namespace]`).
36-
6. When a rule doesn't fall under the above keywords, or for section rule ids, name the subrule as follows:
37-
- If the rule is naming a specific Rust language construct (e.g. an attribute, standard library type/function, or keyword-introduced concept), use the construct as named in the language, appropriately case-adjusted (but do not replace `_`s with `-`s).
35+
- `namespace`: For items only, specifies the namespace(s) the item introduces a name in. It may also be used elsewhere when defining a namespace (e.g. `r[attribute.diagnostic.namespace]`).
36+
6. When a rule doesn't fall under the above keywords, or for section rule IDs, name the subrule as follows:
37+
- If the rule names a specific Rust language construct (e.g., an attribute, standard library type/function, or keyword-introduced concept), use the construct as named in the language, appropriately case-adjusted (but do not replace `_`s with `-`s).
3838
- Other than Rust language concepts with `_`s in the name, use `-` characters to separate words within a "subrule".
3939
- Whenever possible, do not repeat previous components of the rule.
4040
- Edition differences admonitions should typically be named by the edition where the behavior changed. You should be able to correspond the dates to the chapters in <https://doc.rust-lang.org/edition-guide/>.
41-
- Target specific admonitions should typically be named by the least specific target property to which they apply (e.g. if a rule affects all x86 CPUs, the rule name should include `x86` rather than separately listing `i586`, `i686` and `x86_64`, and if a rule applies to all ELF platforms, it should be named `elf` rather than listing every ELF OS).
41+
- Target-specific admonitions should typically be named by the least specific target property to which they apply (e.g., if a rule affects all x86 CPUs, the rule name should include `x86` rather than separately listing `i586`, `i686`, and `x86_64`. If a rule applies to all ELF platforms, it should be named `elf` rather than listing every ELF OS).
4242
- Use an appropriately descriptive, but short, name if the language does not provide one.
4343

4444
[automatic link references]: ../links.md#rule-links
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# rustc test annotations
22

3-
Tests in <https://github.com/rust-lang/rust> can be linked to rules in the reference. The rule will include a link to the tests, and there is also an [appendix] which tracks how the rules are currently linked.
3+
Tests in <https://github.com/rust-lang/rust> can be linked to rules in the Reference. The rule will include a link to the tests, and there is also an [appendix] which tracks how the rules are currently linked.
44

5-
Tests in the `tests` directory can be annotated with the `//@ reference: x.y.z` header to link it to a rule. The header can be specified multiple times if a single file covers multiple rules.
5+
Tests in the `tests` directory can be annotated with the `//@ reference: x.y.z` header to link them to a rule. The header can be specified multiple times if a single file covers multiple rules.
66

7-
Compiler developers are not expected to add `reference` annotations to tests. However, if they do want to help, their cooperation is very welcome. Reference authors and editors are responsible for making sure every rule has a test associated with it.
7+
Compiler developers are not expected to add `reference` annotations to tests. However, if they do want to help, their cooperation is very welcome. Reference authors and editors are responsible for ensuring every rule has a test associated with it.
88

9-
The tests are beneficial for reviewers to see the behavior of a rule. It is also a benefit to readers who may want to see examples of particular behaviors. When adding new rules, you should wait until the reference side is approved before submitting a PR to `rust-lang/rust` (to avoid churn if we decide on different names).
9+
The tests are beneficial for reviewers to see the behavior of a rule. They are also a benefit to readers who may want to see examples of particular behaviors. When adding new rules, you should wait until the Reference side is approved before submitting a PR to `rust-lang/rust` (to avoid churn if we decide on different names).
1010

1111
Prefixed rule names should not be used in tests. That is, do not use something like `asm.rules` when there are specific rules like `asm.rules.reg-not-input`.
1212

13-
We are not expecting 100% coverage at any time. Although it would be nice, it is unrealistic due to the sequence things are developed, and resources available.
13+
We do not expect 100% coverage at any time. Although it would be nice, it is unrealistic due to the sequence in which things are developed and the resources available.
1414

1515
[appendix]: https://doc.rust-lang.org/nightly/reference/test-summary.html

0 commit comments

Comments
 (0)