Stream: t-compiler/help

Topic: Procedure for adding an error code


ecstatic-morse (Nov 06 2019 at 19:42, on Zulip):

Are there instructions somewhere for what to do to add an error code to the compiler?

ecstatic-morse (Nov 06 2019 at 19:43, on Zulip):

The diagnostics section of the rustc guide doesn't seem to have anything pertinent

mark-i-m (Nov 07 2019 at 22:26, on Zulip):

cc @GuillaumeGomez I think?

mark-i-m (Nov 07 2019 at 22:26, on Zulip):

Also, when you find out, a PR to the rustc-guide would be much appreciated

GuillaumeGomez (Nov 07 2019 at 22:31, on Zulip):

I think I never wrote about it...

GuillaumeGomez (Nov 07 2019 at 22:32, on Zulip):

But to put it simply: find the highest error code number (E0XXX), then add it into the error_code.rs file of the lib you're currently modifying

GuillaumeGomez (Nov 07 2019 at 22:32, on Zulip):

also please add the long error explanation, that'd make my life a lot simpler

ecstatic-morse (Nov 08 2019 at 00:20, on Zulip):

@GuillaumeGomez That's pretty much what I ended up doing.

Is there a reason that error codes are split across crates instead of combined into a single one with minimal dependencies? Seems like doing so would make this easier, as well as move some code out of librustc and libsyntax, which are on the critical path when building rustc.

centril (Nov 08 2019 at 07:06, on Zulip):

@ecstatic-morse +100 -- would be much smoother! also e.g. when splitting crates

centril (Nov 08 2019 at 07:07, on Zulip):

I'll make an issue for this to discuss

GuillaumeGomez (Nov 08 2019 at 09:52, on Zulip):

I answered on the issue why I don't think it's a good idea.

centril (Nov 08 2019 at 10:07, on Zulip):

Thanks

nikomatsakis (Nov 08 2019 at 20:53, on Zulip):

also please add the long error explanation, that'd make my life a lot simpler

there is an accepted RFC somewhere that @GuillaumeGomez giving the general format; if/when you document in the rustc-guide, @ecstatic-morse, can you include some of that template?

GuillaumeGomez (Nov 08 2019 at 22:11, on Zulip):

I knew I had something! Having documentation pointing to it would definitely be useful.

Last update: Nov 11 2019 at 22:10UTC