Skip to main content

ManifestError

Enum ManifestError 

Source
pub enum ManifestError {
    Missing {
        manifest_path: PathBuf,
    },
    Unreadable {
        manifest_path: PathBuf,
        message: String,
    },
    Malformed {
        manifest_path: PathBuf,
        message: String,
    },
    InvalidName {
        manifest_path: PathBuf,
        name: String,
    },
    InvalidVersion {
        manifest_path: PathBuf,
        version: String,
    },
    InvalidDependencyName {
        manifest_path: PathBuf,
        table: &'static str,
        name: String,
    },
    InvalidDependencyEntry {
        manifest_path: PathBuf,
        table: &'static str,
        package: String,
        reason: String,
    },
    DependencyListedTwice {
        manifest_path: PathBuf,
        name: String,
    },
    PrivateModuleNotFound {
        manifest_path: PathBuf,
        name: Name,
    },
    MainModuleNotFound {
        manifest_path: PathBuf,
        name: Name,
    },
}
Expand description

Every way reading a manifest can fail.

Like SourceFileError, a manifest error has no Span to render: the location it would want is a byte range in zelkova.toml, which is not a file the SourceFiles database holds. Every variant therefore carries the manifest_path it was found in, so that its message can name the file on its own — which is the whole of the location a reader gets, and is why every variant but PrivateModuleNotFound and MainModuleNotFound goes back to the caller unrendered, the same way loading errors already do.

Variants§

§

Missing

No zelkova.toml at all beside src/.

Fields

§manifest_path: PathBuf
§

Unreadable

zelkova.toml exists but could not be read (permissions, not a regular file, …).

Fields

§manifest_path: PathBuf
§message: String
§

Malformed

zelkova.toml is not well-formed TOML, or does not have the shape RawManifest expects — a missing required field among them.

Fields

§manifest_path: PathBuf
§message: String
§

InvalidName

name is not ASCII lowercase letters, digits and hyphens, starting with a letter, with every hyphen followed by a letter.

Fields

§manifest_path: PathBuf
§name: String
§

InvalidVersion

version is not exactly three non-negative integers separated by dots.

Fields

§manifest_path: PathBuf
§version: String
§

InvalidDependencyName

A key of dependencies or test-dependencies is not a legal package name.

Fields

§manifest_path: PathBuf
§table: &'static str
§name: String
§

InvalidDependencyEntry

An entry of dependencies or test-dependencies does not name exactly one source, or pairs that source with a field it does not take.

Fields

§manifest_path: PathBuf
§table: &'static str
§package: String
§reason: String
§

DependencyListedTwice

One package name in both dependencies and test-dependencies — the spec allows a name in at most one of the two.

Fields

§manifest_path: PathBuf
§name: String
§

PrivateModuleNotFound

private-modules names a module this package does not hold.

Unlike every other variant here, this one cannot be raised by load: knowing what the package holds needs its sources loaded, which happens only after the manifest has already been accepted. compile_package builds this once it has parsed every module, and folds it into the normal per-package error accumulation rather than the unrendered path the rest of this enum takes.

Fields

§manifest_path: PathBuf
§name: Name
§

MainModuleNotFound

main names a module this package does not hold under src/ — a module under tests/ does not count.

Raised after the package’s src/ has checked, for the same reason as PrivateModuleNotFound, and by the check program describes, whose other two failures are about the module the name finds.

Fields

§manifest_path: PathBuf
§name: Name

Trait Implementations§

Source§

impl Debug for ManifestError

Source§

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

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

impl PhaseError for ManifestError

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§

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.