pub enum MaterialiseError {
UnknownType {
type_name: String,
},
NoOrigin {
type_name: String,
},
NoModule {
at: String,
},
NoNode {
kind: &'static str,
at: String,
},
Unevaluated {
construct: String,
at: String,
},
NoLanguageForm {
construct: String,
language: &'static str,
at: String,
},
SpellingCollision {
first: String,
second: String,
spelled: String,
language: &'static str,
at: String,
},
}Expand description
Why a created node could not be materialised.
Variants§
UnknownType
A created node’s type has no CST counterpart.
NoOrigin
A created node has no model node behind it.
Every CST node needs its values, and the values come from the model; a node with no origin has nowhere to get them.
NoModule
The module an item nests inside cannot be read from the model.
Reported rather than absorbed. A module id the arena does not
answer for, or a parent chain deeper than MAX_MODULE_DEPTH,
used to return the items unwrapped — NameComponent at the
crate root instead of inside pub mod CosNaming. The scope is
part of the declaration: module a { struct P; }; and
module b { struct P; }; are two types, and flattening them is
the same class of substitution as writing the wrong octet.
Fields
NoNode
A child the model listed and then would not hand over.
A walk asks the model for a type’s members, cases, enumerators or bits and then reads each one by its handle. A handle that does not resolve means the model contradicts itself, and the only honest answer is to say so: skipping the child emits an aggregate with a field missing, a union with an arm missing or an enumeration with a value missing, and reports success. Nothing downstream can tell such a type from one the source declared that way — it is the same class of substitution as writing the wrong octet, and it reaches the wire.
Fields
Unevaluated
A value the output has to state does not evaluate.
An array length, a constant’s value, an enumerator’s value or a
bit’s position. Substituting a zero would put a plausible number
in the generated source — a [T; 0] where an array belongs, or
two enumerators sharing a discriminant — and nothing downstream
could tell it from a number the source asked for.
Fields
NoLanguageForm
A construct the model holds and the target language cannot.
Named rather than skipped. A generator that left the member out would emit a type missing a field and report success; one that wrote the construct’s IDL spelling into the output would emit a file no compiler reads and report success. Both are the same failure and this is the third answer.
Fields
SpellingCollision
Two declarations in one scope spell the same name in the target.
Every column escapes a name that collides with a keyword of its
language by appending an underscore, so an IDL int becomes a C
int_. A scope that already declares int_ then has two
members with one name, and the escape has silently made one of
them unreachable.
What each column does with that today is not the same, and none
of it names the cause: the C compiler says duplicate member 'int_', Python says keyword argument repeated, and a column
whose target permits the duplicate says nothing at all — the
second declaration wins and one member is dropped from a file
that compiles. The escape is the only layer that holds both
spellings at once, which is why the check is here and not in
seven backends.
Trait Implementations§
Source§impl Clone for MaterialiseError
impl Clone for MaterialiseError
Source§impl Debug for MaterialiseError
impl Debug for MaterialiseError
Source§impl Display for MaterialiseError
impl Display for MaterialiseError
impl Eq for MaterialiseError
Source§impl Error for MaterialiseError
impl Error for MaterialiseError
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()