You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This adds the ability to link rust-lang/rust tests to reference rule
annotations. Rules now have a link that pops up a list of tests that
are associated with that rule. Additionally, there is a new appendix
that lists the number of rules in each chapter, how many tests are
associated, and various summaries.
This requires a local checkout of rust-lang/rust which is pointed to
by the `SPEC_RUST_ROOT` environment variable.
Copy file name to clipboardExpand all lines: README.md
+4
Original file line number
Diff line number
Diff line change
@@ -81,3 +81,7 @@ The published site at <https://doc.rust-lang.org/reference/> (or local docs usin
81
81
### `SPEC_DENY_WARNINGS`
82
82
83
83
The `SPEC_DENY_WARNINGS=1` environment variable will turn all warnings generated by `mdbook-spec` to errors. This is used in CI to ensure that there aren't any problems with the book content.
84
+
85
+
### `SPEC_RUST_ROOT`
86
+
87
+
The `SPEC_RUST_ROOT` can be used to point to the directory of a checkout of <https://github.com/rust-lang/rust>. This is used by the test-linking feature so that it can find tests linked to reference rules. If this is not set, then the tests won't be linked.
Copy file name to clipboardExpand all lines: docs/authoring.md
+12
Original file line number
Diff line number
Diff line change
@@ -99,6 +99,18 @@ When assigning rules to new paragraphs, or when modifying rule names, use the fo
99
99
* 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).
100
100
* Use an appropriately descriptive, but short, name if the language does not provide one.
101
101
102
+
#### Test rule annotations
103
+
104
+
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.
105
+
106
+
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.
107
+
108
+
You *should* when possible make sure every rule has a test associated with it. This is beneficial for reviewers to see the behavior and 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).
109
+
110
+
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`.
111
+
112
+
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.
113
+
102
114
### Standard library links
103
115
104
116
You should link to the standard library without specifying a URL in a fashion similar to [rustdoc intra-doc links][intra]. Some examples:
0 commit comments