pub enum InfixDeclaration {
InThisModule(NodeSpan),
InImportedModule(SourceSpan),
Unknown,
}Expand description
Part of Error::AmbiguousOperatorPrecedence’s public shape, so it is
re-exported alongside the error rather than left behind a private module.
Where an operator’s infix declaration was written, to the extent
canonicalization can say — the three cases a SpanLabel under it has to
distinguish.
A phase only ever sees one module and never learns which file it was read from,
so a label about the module under check leaves SpanLabel::file as None and
the driver fills it in at render time. A label about an imported operator
cannot do that: its span belongs to
the exporting module’s file, and rendering it against the importing one
underlines unrelated text. That is what SourceSpan and SpanLabel::file
were built for (ERR-5), and this enum is what picks between them.
Variants§
InThisModule(NodeSpan)
Declared by the module under check. Its span is a byte range in the file the diagnostic is already being rendered against.
InImportedModule(SourceSpan)
Declared by an imported module whose Interface knew both the span and
the file it was written in.
Unknown
Declared by an imported module whose Interface could not say which file
it came from — a hand-built one, or one built before its file was known
(see Interface::source_span). There is nothing honest to underline, so
a diagnostic renders no label rather than one against the wrong file.
Implementations§
Trait Implementations§
Source§impl Clone for InfixDeclaration
impl Clone for InfixDeclaration
Source§fn clone(&self) -> InfixDeclaration
fn clone(&self) -> InfixDeclaration
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more