pub struct ParseError {
pub kind: ParseErrorKind,
pub span: Span,
}Expand description
A parse error with location information.
Fields§
§kind: ParseErrorKind§span: SpanImplementations§
Source§impl ParseError
impl ParseError
pub fn display_with_source(&self, source: &str) -> String
Sourcepub fn suggestion(&self, source: &str) -> Option<&'static str>
pub fn suggestion(&self, source: &str) -> Option<&'static str>
The “did you mean” word for this error’s span, when the error is about the word under it
(is_about_a_word) and the span covers an alphabetic word within edit distance 2 of a
known word. The caret renderer and the logos-diagnostic/1 JSON surface share this one
suggester so their hints can never disagree.
Sourcepub fn diagnostic_parts(&self, source: &str) -> DiagnosticParts
pub fn diagnostic_parts(&self, source: &str) -> DiagnosticParts
The structured pieces of a caret diagnostic — the Socratic message, the source
line, the caret column + length, and the optional “did you mean”. Shared by the
terminal renderer and the browser build-error overlay so the two can never drift.
(socratic_explanation ignores its interner, so a fresh one is fine here.)
Trait Implementations§
Source§impl Clone for ParseError
impl Clone for ParseError
Source§fn clone(&self) -> ParseError
fn clone(&self) -> ParseError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ParseError
impl RefUnwindSafe for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl UnsafeUnpin for ParseError
impl UnwindSafe for ParseError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more