Module tidy::error_codes
source · Expand description
Tidy check to ensure error codes are properly documented and tested.
Overview of check:
-
We create a list of error codes used by the compiler. Error codes are extracted from
compiler/rustc_error_codes/src/error_codes.rs
. -
We check that the error code has a long-form explanation in
compiler/rustc_error_codes/src/error_codes/
.
- The explanation is expected to contain a
doctest
that fails with the correct error code. (EXEMPT_FROM_DOCTEST
currently bypasses this check) - Note that other stylistic conventions for markdown files are checked in the
style.rs
tidy check.
- We check that the error code has a UI test in
tests/ui/error-codes/
.
- We ensure that there is both a
Exxxx.rs
file and a correspondingExxxx.stderr
file. - We also ensure that the error code is used in the tests.
- Currently, it is possible to opt-out of this check with the
EXEMPTED_FROM_TEST
constant.
- We check that the error code is actually emitted by the compiler.
- This is done by searching
compiler/
with a regex.
Macros
Constants
Functions
- Stage 2: Checks that long-form error code explanations exist and have doctests.
- Stage 4: Search
compiler/
and ensure that every error code is actually used by the compiler and that no undocumented error codes exist. - This function returns a tuple indicating whether the provided explanation: a) has a code example, tested or not. b) has a valid doctest
- Stage 1: Parses a list of error codes from
error_codes.rs
.