Enum SemanticError

Source
pub enum SemanticError {
    UnsupportedVersion,
    DuplicateRegisterDeclaration,
    WrongNumberOfParameters,
    WrongNumberOfTargets,
    UnknownIdentifier,
    IndexedRegisterInGateDecl,
    SameTargetUsedTwice,
    InvalidTargetDimensions,
    IndexOutOfBounds,
    OpaqueIsNotSupported,
}
Expand description

The different errors that can occur when running semantic analysis on an AST.

Variants§

§

UnsupportedVersion

Only openqasm 2.0 is supported, so the first line has to be: OPENQASM 2.0;

§

DuplicateRegisterDeclaration

Two registers have been defined with the same name.

§

WrongNumberOfParameters

An operation was applied with the wrong number of parameters.

§

WrongNumberOfTargets

An operation was applied with the wrong number of qubits.

§

UnknownIdentifier

An identifier was used which had not been previously defined.

§

IndexedRegisterInGateDecl

Inside of a gate declaration you are only allowed to use the parameters and arguments defined in the gate declaration. The arguments are not allowed to be indexed inside the gate definition, otherwise this error is returned.

§

SameTargetUsedTwice

An operation was applied to some qubits which contained the same qubit several times.

§

InvalidTargetDimensions

An operation can be called on entire registers or on single qubits. When more than one of the arguments specify an entire register then all these registers have to have the same size. Otherwise this error is returned.

§

IndexOutOfBounds

A register was indexed outside of its range [0..size)

§

OpaqueIsNotSupported

An opaque gate is one which doesn’t have a definition. This is currently not supported.

Trait Implementations§

Source§

impl Debug for SemanticError

Source§

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

Formats the value using the given formatter. Read more

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.