I see this code in the lexer:
let mut err = self.struct_span_fatal(pos, pos, "unterminated raw string"); err.span_label(self.mk_sp(pos, pos), "unterminated raw string");
is it ok that we duplicate the message, or should we just remove the span_label?
git blame reveal anything about why it was added? (or was it there from the beginning?)
cc @Esteban Küber
IIRC, the general idea is "no label - bad", so labels are added even if they duplicate the primary message.
If there's no label, then the most valuable place on the diagnostic space - text attached to the precise pointer to an error location
^^^ - becomes vacant.
@Vadim Petrochenkov perhaps we could encode that philosophy ("no label -
bad") directly into the diagnostic API? E.g., have
struct_span_foo take two message arguments, rather than expecting callers to call
span_label themselves ?
(and having it take two message arguments might encourage diagnostic authors to consider varying the text...)
Its something I've toyed with but it does make the API more unwieldy
Well probably end up with that regardless
As for the original question petrochencov is spot on. Normally we can benefit by restating with a different wording that can help understanding, but in this case there's very little gramatical wiggle room