pub struct ModuleDiagnostic {
pub message: String,
pub labels: Vec<SourceLabel>,
pub cause: Option<ModuleCause>,
}Expand description
Owns a module error message and all sources needed by its labels.
let diagnostic = adam_lang::ModuleDiagnostic {
message: "invalid native use".into(),
labels: vec![adam_lang::SourceLabel { location: None, label: "native".into() }],
cause: None,
};
assert!(diagnostic.labels[0].location.is_none());Fields§
§message: StringExplains the failed module operation.
labels: Vec<SourceLabel>Identifies implicated definitions and uses in diagnostic order.
cause: Option<ModuleCause>Retains an underlying construction error without replacing it with display text.
Trait Implementations§
Source§impl Clone for ModuleDiagnostic
impl Clone for ModuleDiagnostic
Source§impl Debug for ModuleDiagnostic
impl Debug for ModuleDiagnostic
Source§impl Display for ModuleDiagnostic
impl Display for ModuleDiagnostic
impl Eq for ModuleDiagnostic
Source§impl Error for ModuleDiagnostic
impl Error for ModuleDiagnostic
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Borrows the retained original error, if this diagnostic wraps a construction failure.
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl PartialEq for ModuleDiagnostic
impl PartialEq for ModuleDiagnostic
impl StructuralPartialEq for ModuleDiagnostic
Auto Trait Implementations§
impl !RefUnwindSafe for ModuleDiagnostic
impl !Send for ModuleDiagnostic
impl !Sync for ModuleDiagnostic
impl !UnwindSafe for ModuleDiagnostic
impl Freeze for ModuleDiagnostic
impl Unpin for ModuleDiagnostic
impl UnsafeUnpin for ModuleDiagnostic
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.