Enum ModuleError

Source
pub enum ModuleError {
    Parse {
        module: String,
        source: String,
        error: SyntaxError,
    },
    NotFound {
        module: String,
        from: String,
        path: String,
        source_name: String,
        span: SourceSpan,
    },
    ImportCycle {
        cycle: String,
        source_name: String,
        span: SourceSpan,
    },
    DuplicateImport {
        module: String,
        import: String,
        source_name: String,
        first_span: SourceSpan,
        duplicate_span: SourceSpan,
    },
    BrowserStaticImportUnsupported {
        allowed: String,
        found: String,
        source_name: String,
        span: SourceSpan,
    },
    Io {
        path: String,
        error: Error,
    },
}
Expand description

Module resolution error produced while loading imports.

Variants§

§

Parse

Imported module failed to parse.

Fields

§module: String

Logical module name requested by the importer.

§source: String

Source file path where parsing failed.

§error: SyntaxError

Underlying syntax error from parsing.

§

NotFound

Imported module path could not be resolved.

Fields

§module: String

Logical module name requested by the importer.

§from: String

Module containing the import statement.

§path: String

Candidate filesystem path that was attempted.

§source_name: String

Source file where the import appears.

§span: SourceSpan

Span of the import clause.

§

ImportCycle

Cyclic import chain was detected.

Fields

§cycle: String

Human-readable cycle path.

§source_name: String

Source file where cycle detection surfaced.

§span: SourceSpan

Span of the triggering import.

§

DuplicateImport

The same import name was declared twice in one module.

Fields

§module: String

Module containing the duplicate import.

§import: String

Duplicate imported module name.

§source_name: String

Source file where the duplicate appears.

§first_span: SourceSpan

Span of the first import declaration.

§duplicate_span: SourceSpan

Span of the second import declaration.

§

BrowserStaticImportUnsupported

Browser import violated static-import restrictions.

Fields

§allowed: String

Required static import path.

§found: String

Import path found in source.

§source_name: String

Source file containing the unsupported import.

§span: SourceSpan

Span of the unsupported import.

§

Io

Reading a module file from disk failed.

Fields

§path: String

Filesystem path that failed to read.

§error: Error

Underlying I/O error.

Implementations§

Source§

impl ModuleError

Source

pub fn diagnostic_line_column(&self) -> Option<(usize, usize)>

Return the primary diagnostic line/column when one is available.

Trait Implementations§

Source§

impl Debug for ModuleError

Source§

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

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

impl Display for ModuleError

Source§

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

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

impl Error for ModuleError

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<DE> From<ModuleError> for CompileError<DE>
where DE: Error + 'static,

Source§

fn from(source: ModuleError) -> Self

Converts to this type from the input type.

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