Stream: t-compiler/help

Topic: Emit parse warning


Camelid (Jun 13 2020 at 21:12, on Zulip):

How do I emit a warning on a parser instance from another module? (Specifically, I'm in the asm! parsing module.)

Camelid (Jun 13 2020 at 23:31, on Zulip):

I tried doing

p.sess
    .span_diagnostic
    .struct_span_warn(p.prev_token.span, "Duplicate option")
    .emit();

where p: &mut Parser<'a>, but nothing happened. I also tried emitting an error instead, but still no error was emitted.

Am I missing something?

Camelid (Jun 13 2020 at 23:47, on Zulip):

Oh wow, I just realized why it didn't work: my test code didn't have that issue in it, so the warning wasn't triggered :face_palm:

Vadim Petrochenkov (Jun 14 2020 at 07:11, on Zulip):

Hard-coded warnings are discouraged and should ideally be all replaced with lints or errors.

Camelid (Jun 14 2020 at 19:57, on Zulip):

I'm actually now using an error; I was using a warning because I thought that a breaking change wasn't okay, but it is since I'm working on an unstable feature

Last update: Sep 28 2020 at 16:30UTC