Struct Error

pub struct Error;
Expand description

An error diagnostic.

Implementations§

§

impl Error

pub fn expect_semicolon_at_end_of_declaration( loc: SourceLocation, driver: &mut Driver, )

Emits an error that a semicolon ‘;’ is expected at the end of a declaration.

pub fn redefine_as_different_symbol( identifier: SourceIdentifier<'_>, existing_kind: SymbolKind, existing_loc: SourceLocation, driver: &mut Driver, )

Emits an error that a symbol cannot be redefined to a different kind of symbol.

pub fn redefine_variable_type( variable: SourceIdentifier<'_>, old_type: &AstType, new_type: &AstType, existing_symbol_loc: SourceLocation, driver: &mut Driver, )

Emits an error that a variable cannot be redefined with a different type.

pub fn redefine_variable_value( variable: SourceIdentifier<'_>, existing_symbol_loc: SourceLocation, driver: &mut Driver, )

Emits an error that a variable cannot be redefined with a different value.

pub fn redefine_variable_linkage( variable: SourceIdentifier<'_>, linkage: AstLinkage, existing_symbol_loc: SourceLocation, driver: &mut Driver, )

Emits an error that a variable cannot be redefined with different linkage.

pub fn local_extern_variable_with_initializer( loc: SourceLocation, driver: &mut Driver, )

Emits an error that a local extern variable cannot have an initializer.

pub fn redefine_type_alias_type( alias: SourceIdentifier<'_>, old_type: &AstType, new_type: &AstType, existing_symbol_loc: SourceLocation, driver: &mut Driver, )

Emits an error that a type alias cannot be redefined with different types.

pub fn redefine_function_type( function: SourceIdentifier<'_>, old_type: &AstType, new_type: &AstType, existing_symbol_loc: SourceLocation, driver: &mut Driver, )

Emits an error that a function cannot be redefined with a different type.

pub fn redefine_external_linkage_function_with_internal_linkage( function: SourceIdentifier<'_>, existing_symbol_loc: SourceLocation, driver: &mut Driver, )

Emits an error that a function cannot be redefined with internal linkage if its previous declaration has external linkage.

pub fn redefine_function_body( function: SourceIdentifier<'_>, existing_symbol_loc: SourceLocation, driver: &mut Driver, )

Emits an error that a function cannot be redefined with a different body.

pub fn call_undeclared_function( function: SourceIdentifier<'_>, driver: &mut Driver, )

Emits an error that there is an attempt to call an undeclared function.

pub fn unknown_type_name(type_name: SourceIdentifier<'_>, driver: &mut Driver)

Emits an error that a type name is invalid.

pub fn missing_type_specifier(loc: SourceLocation, driver: &mut Driver)

Emits an error that a type specifier is missing.

pub fn invalid_type_specifier(loc: SourceLocation, driver: &mut Driver)

Emits an error that a type specifier is invalid.

pub fn cannot_combine_type_specifier( specifier: SourceIdentifier<'_>, driver: &mut Driver, )

Emits an error that a type specifier cannot be combined with other specifiers.

pub fn expect_identifier(loc: SourceLocation, driver: &mut Driver)

Emits an error that an identifier is expected.

pub fn identifier_cannot_be_keyword( identifier: SourceIdentifier<'_>, driver: &mut Driver, )

Emits an error that a token is unexpected.

pub fn unexpected_token( token_type: &TokenType, loc: SourceLocation, driver: &mut Driver, )

Emits an error that a token is unexpected.

pub fn invalid_numeric_literal( literal: &str, is_float: bool, base: NumericLiteralBase, loc: SourceLocation, driver: &mut Driver, )

Emits an error that an integer or floating-point literal is invalid.

pub fn invalid_numeric_literal_suffix( suffix: &str, is_float: bool, loc: SourceLocation, driver: &mut Driver, )

Emits an error that the suffix is invalid on an integer or floating-point literal.

pub fn statement_controlling_expr_must_be_scalar( stmt_loc: SourceLocation, expr_loc: SourceLocation, expr_type: &AstType, driver: &mut Driver, )

Emits an error that a statement’s controlling expression must be a scalar.

pub fn expression_must_be_scalar( expr_loc: SourceLocation, expr_type: &AstType, driver: &mut Driver, )

Emits an error that an expression must be a scalar.

pub fn expression_is_not_assignable( assign_op_loc: SourceLocation, lhs_loc: SourceLocation, is_lvalue: bool, assign_type: &AstType, driver: &mut Driver, )

Emits an error that an expression is not assignable because it’s not an lvalue.

pub fn cannot_increment_or_decrement_expression( is_increment: bool, ty: &AstType, loc: SourceLocation, driver: &mut Driver, )

Emits an error that an expression cannot be incremented or decremented.

pub fn indirection_requires_pointer_type( expr_type: &AstType, loc: SourceLocation, driver: &mut Driver, )

Emits an error that the ‘*’ operator requires a pointer type to dereference.

pub fn cannot_take_address_of_rvalue( rvalue_type: &AstType, loc: SourceLocation, driver: &mut Driver, )

Emits an error that the ‘&’ operator cannot take the address of an rvalue.

pub fn variable_has_incomplete_type( loc: SourceLocation, var_ident: SourceIdentifier<'_>, var_type: &AstType, driver: &mut Driver, )

Emits an error that a variable is declared with an incomplete type.

pub fn array_has_incomplete_element_type( loc: SourceLocation, declarator_loc: Option<SourceLocation>, var_type: &AstType, driver: &mut Driver, )

Emits an error that an array has an incomplete element type.

pub fn fn_parameter_has_incomplete_type( loc: SourceLocation, param_ident: SourceIdentifier<'_>, param_type: &AstType, driver: &mut Driver, )

Emits an error that a function parameter is declared with an incomplete type.

pub fn sizeof_incomplete_type( loc: SourceLocation, operand_type: &AstType, driver: &mut Driver, )

Emits an error that ‘sizeof’ cannot be used with an incomplete type (e.g. ‘void’).

pub fn alignof_incomplete_type( loc: SourceLocation, operand_type: &AstType, driver: &mut Driver, )

Emits an error that ‘_Alignof’ cannot be used with an incomplete type (e.g. ‘void’).

pub fn sizeof_function_type(loc: SourceLocation, driver: &mut Driver)

Emits an error that ‘sizeof’ cannot be used with a function type.

pub fn alignof_function_type(loc: SourceLocation, driver: &mut Driver)

Emits an error that ‘_Alignof’ cannot be used with a function type.

pub fn incompatible_types( a: &AstType, b: &AstType, loc: SourceLocation, a_loc: SourceLocation, b_loc: SourceLocation, driver: &mut Driver, )

Emits an error that two types in an expression are incompatible (i.e. there is no common type).

pub fn incompatible_pointer_types( a: &AstType, b: &AstType, loc: SourceLocation, driver: &mut Driver, )

Emits an error that two pointer types are incompatible (i.e. there is no common type).

pub fn incompatible_pointer_types_in_expression( a: &AstType, b: &AstType, loc: SourceLocation, a_loc: SourceLocation, b_loc: SourceLocation, driver: &mut Driver, )

Emits an error that two pointer types are incompatible (i.e. there is no common type).

pub fn incompatible_pointer_types_in_conditional( loc: SourceLocation, a_loc: SourceLocation, b_loc: SourceLocation, a_type: &AstType, b_type: &AstType, driver: &mut Driver, )

Emits an error that two pointer types are incompatible (i.e. there is no common type) in a conditional/ ternary expression.

pub fn incomplete_pointer_arithmetic( op_loc: SourceLocation, ptr_expr_loc: SourceLocation, ptr_type: &AstType, driver: &mut Driver, )

Emits an error that pointer arithmetic cannot be performed on an incomplete pointer type (void *).

pub fn incomplete_pointer_subscript( op_loc: SourceLocation, ptr_expr_loc: SourceLocation, ptr_type: &AstType, driver: &mut Driver, )

Emits an error that a subscript expression cannot be applied to an incomplete pointer type (void *).

pub fn incomplete_pointer_dereference( deref_op_loc: SourceLocation, ptr_expr_loc: SourceLocation, ptr_type: &AstType, driver: &mut Driver, )

Emits an error that an incomplete pointer type (void *) cannot be dereferenced.

pub fn incompatible_fn_pointer_types( a: &AstType, b: &AstType, loc: SourceLocation, driver: &mut Driver, )

Emits an error that two function pointer types are incompatible.

pub fn invalid_unary_expression_operand( operator: &AstUnaryOp, operator_loc: SourceLocation, operand_type: &AstType, operand_loc: SourceLocation, driver: &mut Driver, )

Emits an error that a unary operation has an operand with an invalid type.

pub fn invalid_binary_expression_operands( operator_loc: SourceLocation, lhs: &AstType, rhs: &AstType, lhs_loc: SourceLocation, rhs_loc: SourceLocation, driver: &mut Driver, )

Emits an error that a binary operation has operands with invalid types.

pub fn invalid_call_type( call_type: &AstType, loc: SourceLocation, driver: &mut Driver, )

Emits an error that an expression cannot be called because it has the wrong type.

pub fn function_invalid_return_type( return_type: &AstType, loc: SourceLocation, driver: &mut Driver, )

Emits an error that a function has an invalid return type.

pub fn cannot_assign_to_fn_type( fn_type: &AstType, loc: SourceLocation, driver: &mut Driver, )

Emits an error that a function type is not assignable

pub fn cannot_cast_to_non_scalar_type( cast_op_loc: SourceLocation, expr_loc: SourceLocation, cast_to_type: &AstType, driver: &mut Driver, )

Emits an error that an expression is being casted to a non-scalar type, e.g. array type or function type (not function pointer). Future: structs.

pub fn invalid_cast( cast_op_loc: SourceLocation, expr_loc: SourceLocation, expr_type: &AstType, dest_type: &AstType, driver: &mut Driver, )

Emits an error that an expression cannot be cast to the given dest type. E.g. pointer type to floating-point, or vice versa.

pub fn invalid_implicit_conversion( expr_loc: SourceLocation, expr_type: &AstType, dest_type: &AstType, driver: &mut Driver, )

Emits an error that an expression cannot be implicitly converted to the given dest type.

pub fn incompatible_pointer_to_arithmetic_conversion( ptr_type: &AstType, arith_type: &AstType, loc: SourceLocation, driver: &mut Driver, )

Emits an error that a pointer cannot be converted to an arithmetic type.

pub fn incompatible_arithmetic_to_pointer_conversion( arith_type: &AstType, ptr_type: &AstType, loc: SourceLocation, driver: &mut Driver, )

Emits an error that a pointer cannot be converted to an arithmetic type.

pub fn cannot_initialize_array_with_scalar( init_type: &AstType, loc: SourceLocation, driver: &mut Driver, )

Emits an error that an array must be initialized with an initializer list.

pub fn cannot_initialize_array_with_string_literal( array_type: &AstType, loc: SourceLocation, driver: &mut Driver, )

Emits an error that an array cannot be initialized with a string literal.

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnwindSafe for Error

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.