pub struct PositionedError {
pub error: TypeError,
pub position: Option<Position>,
}Expand description
TypeError enriched with an optional source Position (#306
slice 1) plus a rule_tag + rule_explanation (#306 slice 2).
lex_types::check_program_with_positions returns a
Vec<PositionedError>; the bare check_program keeps the old
Vec<TypeError> shape for backwards compatibility.
Serializes as a flat JSON object: the wrapped error’s fields
(kind, at_node, expected, …), the derived rule_tag +
rule_explanation, and a position field when one was attached.
Consumers can downcast via the error field or pattern-match on
the kind tag in the JSON. The rule_tag is the stable
kebab-case identifier LLM prompts should reference; the
rule_explanation is a plain-language description of what the
rule enforces, suitable to inline in a repair prompt.
Fields§
§error: TypeError§position: Option<Position>Implementations§
Trait Implementations§
Source§impl Clone for PositionedError
impl Clone for PositionedError
Source§fn clone(&self) -> PositionedError
fn clone(&self) -> PositionedError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PositionedError
impl Debug for PositionedError
Source§impl<'de> Deserialize<'de> for PositionedError
impl<'de> Deserialize<'de> for PositionedError
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl Display for PositionedError
impl Display for PositionedError
Source§impl Error for PositionedError
impl Error for PositionedError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()