about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
authorQuietMisdreavus <grey@quietmisdreavus.net>2018-03-12 17:26:20 -0500
committerQuietMisdreavus <grey@quietmisdreavus.net>2018-03-12 17:26:20 -0500
commit373b2cdcd13788249e27d7f06f5c36f37bc8684e (patch)
tree83caa51edc3dd31d09b0830ac2e39cde8243f15c /src/doc
parentc685b57bf27d3ddecd83ab77e1973d36dff755b4 (diff)
downloadrust-373b2cdcd13788249e27d7f06f5c36f37bc8684e.tar.gz
rust-373b2cdcd13788249e27d7f06f5c36f37bc8684e.zip
talk about error numbers for compile_fail doctests
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/rustdoc/src/unstable-features.md23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md
index 35380cdf069..8dbd0aa9a9a 100644
--- a/src/doc/rustdoc/src/unstable-features.md
+++ b/src/doc/rustdoc/src/unstable-features.md
@@ -8,3 +8,26 @@ enable, and thus are more fully documented in the [Unstable Book]. Those section
 there as necessary.
 
 [Unstable Book]: ../unstable-book/
+
+## Error numbers for `compile-fail` doctests
+
+As detailed in [the chapter on documentation tests][doctest-attributes], you can add a
+`compile_fail` attribute to a doctest to state that the test should fail to compile. However, on
+nightly, you can optionally add an error number to state that a doctest should emit a specific error
+number:
+
+[doctest-attributes]: documentation-tests.html#attributes
+
+``````markdown
+```compile_fail,E0044
+extern { fn some_func<T>(x: T); }
+```
+``````
+
+This is used by the error index to ensure that the samples that correspond to a given error number
+properly emit that error code. However, these error codes aren't guaranteed to be the only thing
+that a piece of code emits from version to version, so this in unlikely to be stabilized in the
+future.
+
+Attempting to use these error numbers on stable will result in the code sample being interpreted as
+plain text.