#[non_exhaustive]pub enum MappingError {
MissingField {
rule: usize,
field: &'static str,
},
DuplicateKind {
table: &'static str,
index: usize,
},
DuplicateTypeName {
index: usize,
},
UnknownTemplate {
template: usize,
},
HoleCount {
rule: usize,
expected: usize,
found: usize,
},
ApplyArgs {
template: usize,
},
BadOperator {
fixity: Fixity,
index: usize,
},
TooLarge,
BadJoin {
rule: usize,
},
EmptyOperatorText {
fixity: Fixity,
index: usize,
},
UnknownArchetype {
index: usize,
},
UnknownName {
index: usize,
},
}Expand description
Why a mapping was refused.
§Examples
use lower_lang::{Arch, MappingBuilder, MappingError, Pick};
let mut b = MappingBuilder::<u8>::new();
b.node(1, Arch::If { cond: Pick::Absent, then: Pick::Nth(1), else_: Pick::Absent });
assert_eq!(b.build().unwrap_err(), MappingError::MissingField { rule: 0, field: "cond" });Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
MissingField
Rule rule (in registration order) leaves a required field Absent.
DuplicateKind
A kind has two entries in a table that allows one (table names it:
“token role”, “modifier”, “root”, “prefix operator”, …).
Fields
DuplicateTypeName
A type name is registered twice.
UnknownTemplate
A template id that this mapping did not issue (or, inside a template, one not registered before it).
HoleCount
A node binds a template with the wrong number of picks.
Fields
ApplyArgs
An apply inside template template passes arguments that do not
match the applied template’s holes (count, or kind, or Absent for a
required hole).
BadOperator
An operator maps to a spec that cannot apply at its position: an op of the wrong arity, a compound op HIR does not allow, a policy that does not fit its op, assignment outside binary position, identity outside unary position, or a template whose holes are not one expression per operand.
TooLarge
A table outgrew its index type.
BadJoin
Rule rule joins an interpolated string with a template whose holes
are neither two expressions nor one argument list.
EmptyOperatorText
A text-keyed operator entry has an empty text.
Fields
UnknownArchetype
A per-archetype modifier entry
(modifier_in) names no archetype
(Arch::lsf_name lists the names).
UnknownName
LangPolicy::implicit_receiver is a NameRef this builder did
not issue.
Trait Implementations§
Source§impl Clone for MappingError
impl Clone for MappingError
impl Copy for MappingError
Source§impl Debug for MappingError
impl Debug for MappingError
Source§impl Display for MappingError
impl Display for MappingError
impl Eq for MappingError
Source§impl Error for MappingError
impl Error for MappingError
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()