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
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParseError
impl Debug for ParseError
Source§impl From<Refusal> for ParseError
A refusal as the diagnostic every source-pointing surface already renders: the message, at the
construct’s span. A span-less refusal reports at the start of the program, the one place a
program-wide limit can be said to be.
impl From<Refusal> for ParseError
A refusal as the diagnostic every source-pointing surface already renders: the message, at the construct’s span. A span-less refusal reports at the start of the program, the one place a program-wide limit can be said to be.
Auto 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.