Skip to main content

MaterialiseError

Enum MaterialiseError 

Source
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.

Fields

§type_name: String

The type name the rule created.

§

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.

Fields

§type_name: String

The type name of the node.

§

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

§at: String

The module handle, as far as it can be named without the node the model would not hand over.

§

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

§kind: &'static str

What was asked for: "member", "case", "enumerator", "bitfield", "bit", "operation" or "parameter".

§at: String

Where it sits, as far as the model names it.

§

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

§construct: String

What could not be worked out, in the source’s terms.

§at: String

Where it sits, as far as the model names it.

§

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

§construct: String

The construct, in the source’s terms.

§language: &'static str

The language that has no form for it.

§at: String

Where it sits, as far as the model names it.

§

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.

Fields

§first: String

The two IDL names, in declaration order.

§second: String

The second, which escaped onto the first.

§spelled: String

The spelling they share.

§language: &'static str

The language whose keyword forced the escape.

§at: String

The scope holding both.

Trait Implementations§

Source§

impl Clone for MaterialiseError

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MaterialiseError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for MaterialiseError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for MaterialiseError

Source§

impl Error for MaterialiseError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<MaterialiseError> for BindingError

Source§

fn from(error: MaterialiseError) -> Self

Converts to this type from the input type.
Source§

impl From<MaterialiseError> for RustInterfaceError

Source§

fn from(error: MaterialiseError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for MaterialiseError

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MaterialiseError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.