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: PackageNameThe dependency entry that led here, so the error names a package the reader wrote rather than only a path they may never have seen.
error: ManifestErrorUnsupportedSource
A dependency entry names a source this compiler cannot obtain.
SourceUnreachable
A path source names a directory that could not be reached.
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.
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.
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.
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.
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.