Skip to content

--explain should disambiguate nonexistent from underdocumented error codes #44710

Closed
@zackmdavis

Description

@zackmdavis

The --explain EXXX functionality (does anyone still uses this now that it's no longer advertised so hard?) gives the same "no extended information" message for real error codes that don't have a "long" explanation written, and nonexistent codes. These messages should be disambiguated (as "no extended information for E0XXX" vs. "E0XXX does not exist" or similar).

$ rustc --explain E0489 # "type/lifetime parameter not in scope here"
error: no extended information for E0489

$ rustc --explain E9999nonexisting
error: no extended information for E9999nonexisting

I thought this would be straightforward to implement: we do keep track of codes without explanations (which get successfully plumbed through to the error index, although the CSS hides them), only to throw that information away when macroexpanding the arrays that ultimately stock the --explain functionality. So this should, you would think, just be a matter of editing expand_build_diagnostic_array to give us a [(&str, Option<&str>)] of code–maybe-explanation pairs instead of a [(&str, &str)] of code–explanation pairs, editing errors::Registry reflect that, and making the driver care.

But when I actually do this (zackmdavis/rust@048dde26e) ... my changes to expand_build_diagnostic_array seem to have absolutely no effect (!?!); we still get a [(&str, &str)] even though I thought my code pretty clearly said otherwise, on more than one day that I've looked at this. I hereby give up in despair, bafflement, and tears.

This issue has been assigned to @jakevossen5 via this comment.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions