#[non_exhaustive]pub enum ProblemKind {
Show 14 variants
SyntaxError,
Unmapped,
Unsupported,
NotAllowedHere {
expected: Context,
},
MissingField {
field: &'static str,
},
AmbiguousChild,
UnknownOperator,
UnknownLabel,
InvalidLiteral,
InvalidEscape,
BadSpan,
MissingHole {
template: TemplateId,
},
ExpansionTooDeep {
template: TemplateId,
},
Hir(HirError),
}Expand description
What is wrong with one construct.
Every kind except Hir comes from lowering itself; a
Hir problem comes from hir-lang’s lenient validator (a break outside a
loop, a duplicate named argument, an out-of-range literal, …). Either
way the construct became an HIR error form and the rest of the unit was
lowered.
§Examples
use lower_lang::ProblemKind;
assert_eq!(ProblemKind::UnknownLabel.to_string(), "no enclosing loop or block has this label");Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
SyntaxError
A syntax error node from the parser (already reported by it; listed so a host can tell lowering skipped the region).
Unmapped
A node or token kind the mapping does not describe.
Unsupported
A construct the mapping marks Unsupported.
NotAllowedHere
A construct in a context it cannot appear in (a let used as an
expression, a call used as a type).
MissingField
A required part is missing (half-typed code: if with no condition,
fn with no name).
AmbiguousChild
One child was selected for two fields of a construct (positional
picks alias in half-typed code, such as while { ... } with its
condition missing). The first field keeps it; the later one is left
absent.
UnknownOperator
An operator token with no entry in the operator table for its position.
UnknownLabel
A break or continue whose label no enclosing loop or block has.
InvalidLiteral
A number or character literal that does not decode (bad digits, too large for its radix, an empty or multi-character char literal).
InvalidEscape
An escape sequence the literal’s escape style does not define.
BadSpan
A token’s span does not lie inside the source text (a host bug).
MissingHole
A required hole of a template is absent (the node lacks the part the
template needs, such as a while without its condition).
Fields
template: TemplateIdThe template.
ExpansionTooDeep
A template application nested deeper than
Budget::max_expansion_depth.
Fields
template: TemplateIdThe template that could not be applied.
Hir(HirError)
A problem hir-lang’s lenient validator found and repaired.