Module tidy::error_codes

source ·
Expand description

Tidy check to ensure error codes are properly documented and tested.

Overview of check:

  1. We create a list of error codes used by the compiler. Error codes are extracted from compiler/rustc_error_codes/src/error_codes.rs.

  2. 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.
  1. 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 corresponding Exxxx.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.
  1. We check that the error code is actually emitted by the compiler.
  • This is done by searching compiler/ with a regex.

Macros

Constants

Functions