Skip to main content

Error

Enum Error 

Source
pub enum Error {
    Manifest {
        package: PackageName,
        error: ManifestError,
    },
    UnsupportedSource {
        manifest_path: PathBuf,
        package: PackageName,
    },
    SourceUnreachable {
        manifest_path: PathBuf,
        package: PackageName,
        path: PathBuf,
        message: String,
    },
    NameMismatch {
        manifest_path: PathBuf,
        expected: PackageName,
        declared: PackageName,
        path: PathBuf,
    },
    ConflictingSources {
        package: PackageName,
        first: PathBuf,
        second: PathBuf,
    },
    Cycle(Vec<PackageName>),
    DependencyNotCompiled {
        package: PackageName,
        dependency: PackageName,
    },
    ModuleNameCollision {
        package: PackageName,
        name: Name,
        first: ModuleOrigin,
        second: ModuleOrigin,
    },
    ReservedModuleName {
        package: PackageName,
        module: ModuleOrigin,
    },
}
Expand description

Every way resolving a build, or naming the modules in one, can fail.

Like a ManifestError, none of these has a span: what each is about is a zelkova.toml, which is not a file the SourceFiles database holds, so every variant names the manifest it was found in inside its own message.

Variants§

§

Manifest

A dependency’s own manifest is missing, malformed, or fails one of its rules.

The root package’s manifest never reaches here — compile_package reads it before resolution starts and reports it as CompilationError::Manifest.

Fields

§package: PackageName

The dependency entry that led here, so the error names a package the reader wrote rather than only a path they may never have seen.

§

UnsupportedSource

A dependency entry names a source this compiler cannot obtain.

Fields

§manifest_path: PathBuf
§package: PackageName
§

SourceUnreachable

A path source names a directory that could not be reached.

Fields

§manifest_path: PathBuf
§package: PackageName
§path: PathBuf
§message: String
§

NameMismatch

The package found at a source declares a name other than the one the entry asked for. A dependent derives a namespace from the key it wrote, so a package answering to another name would have that namespace put on modules it has never heard of.

Fields

§manifest_path: PathBuf
§expected: PackageName
§declared: PackageName
§path: PathBuf
§

ConflictingSources

One package name given two different directories in one build. A name is a package’s identity for the whole build, not a label local to the manifest that writes it.

Fields

§package: PackageName
§first: PathBuf
§second: PathBuf
§

Cycle(Vec<PackageName>)

A package depends on itself, directly or through a chain. The members of a cycle have no order they could be compiled in.

§

DependencyNotCompiled

A package was not compiled because one of its dependencies was not.

This never stands alone: whatever went wrong in the dependency is already reported, and this says which package was left uncompiled as a result — so a user reading a dependency’s diagnostics knows why nothing was said about the package they pointed the compiler at.

Fields

§package: PackageName
§dependency: PackageName
§

ModuleNameCollision

Two modules answer to one name in one package.

Reported when the build is resolved, before any module of that package is compiled, naming both modules and the packages they come from — Two modules under one name.

Fields

§package: PackageName
§name: Name
§

ReservedModuleName

A package other than zelkova-core declares a local module named after one of the eight default imports — default_imports::is_default — under either source root.

Reported when the build is resolved, before any module of the package is compiled, the same as ModuleNameCollision: this is what makes DEC-17’s premise true rather than assumed, ahead of LANG-62 giving the rest of zelkova-core’s module names the same protection. The module is reported and not claimed, so a build that also contains zelkova-core does not additionally report a ModuleNameCollision for the same name.

Fields

§package: PackageName

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl PhaseError for Error

Source§

fn message(&self) -> String

One line naming what went wrong, in the vocabulary of the user’s source. Read more
Source§

fn notes(&self) -> Vec<String>

Supporting detail, one string per rendered note. Empty by default.
Source§

fn labels(&self) -> Vec<SpanLabel>

The regions of the user’s source this error is about, if it knows any. Read more
Source§

fn message_and_notes(&self) -> Vec<String>

This error’s message followed by its notes. Read more

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin 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.