Skip to content

Commit 9fb586c

Browse files
authored
Rollup merge of #115278 - RalfJung:removed-error-codes, r=GuillaumeGomez
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``
2 parents 8140856 + 776466d commit 9fb586c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

compiler/rustc_error_codes/src/error_codes.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,8 @@ E0793: include_str!("./error_codes/E0793.md"),
516516
E0794: include_str!("./error_codes/E0794.md"),
517517
}
518518

519-
// Undocumented removed error codes. Note that many removed error codes are documented.
519+
// Undocumented removed error codes. Note that many removed error codes are kept in the list above
520+
// and marked as no-longer emitted with a note in the markdown file (see E0001 for an example).
520521
// E0006, // merged with E0005
521522
// E0008, // cannot bind by-move into a pattern guard
522523
// E0019, // merged into E0015

src/tools/tidy/src/error_codes.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,12 @@ fn check_error_codes_used(
354354

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

360365
if found_codes.contains(code) && no_longer_emitted.contains(code) {

0 commit comments

Comments
 (0)