Skip to content

Commit

Permalink
Rollup merge of rust-lang#115278 - RalfJung:removed-error-codes, r=Gu…
Browse files Browse the repository at this point in the history
…illaumeGomez

tell people what to do when removing an error code

Currently tidy and CI send developers on a wild goose chase:
- you edit the code
- CI/tidy tells you that an error code is gone, so you remove it from the list
- CI/tidy tells you that the markdown file is stale, so you remove that as well
- CI (but not tidy) tells you not to remove an error description and copy what E0001 does

Let's be nice to people and directly tell them what to do rather than making them follow misleading breadcrumbs.

r? `@GuillaumeGomez`
  • Loading branch information
GuillaumeGomez authored Aug 27, 2023
2 parents d7d3da2 + 776466d commit 41f5ffd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion compiler/rustc_error_codes/src/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,8 @@ E0793: include_str!("./error_codes/E0793.md"),
E0794: include_str!("./error_codes/E0794.md"),
}

// Undocumented removed error codes. Note that many removed error codes are documented.
// Undocumented removed error codes. Note that many removed error codes are kept in the list above
// and marked as no-longer emitted with a note in the markdown file (see E0001 for an example).
// E0006, // merged with E0005
// E0008, // cannot bind by-move into a pattern guard
// E0019, // merged into E0015
Expand Down
7 changes: 6 additions & 1 deletion src/tools/tidy/src/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,12 @@ fn check_error_codes_used(

for code in error_codes {
if !found_codes.contains(code) && !no_longer_emitted.contains(code) {
errors.push(format!("Error code `{code}` exists, but is not emitted by the compiler!"))
errors.push(format!(
"Error code `{code}` exists, but is not emitted by the compiler!\n\
Please mark the code as no longer emitted by adding the following note to the top of the `EXXXX.md` file:\n\
`#### Note: this error code is no longer emitted by the compiler`\n\
Also, do not forget to mark doctests that no longer apply as `ignore (error is no longer emitted)`."
));
}

if found_codes.contains(code) && no_longer_emitted.contains(code) {
Expand Down

0 comments on commit 41f5ffd

Please sign in to comment.