pub enum LoadError {
Show 27 variants
Io {
path: PathBuf,
source: Error,
},
Parse {
path: PathBuf,
source: ParseFileError,
},
UnresolvedRequire {
name: String,
searched: Vec<PathBuf>,
},
UnresolvedImport {
name: String,
from: PathBuf,
searched: Vec<PathBuf>,
},
Cycle {
chain: Vec<PathBuf>,
},
DocumentAsDependency {
path: PathBuf,
},
LibraryAsEntry {
path: PathBuf,
},
UnsupportedVersion {
requested: RustyfiVersion,
supported: Vec<RustyfiVersion>,
},
InvalidModeVersion {
version: RustyfiVersion,
},
SourceProviderUnderEnvelopes,
PackageDependencyUnresolved {
module: String,
from: PathBuf,
},
BareUseOutsidePackage {
module: String,
from: PathBuf,
},
UnresolvedUseOf {
relpath: String,
from: PathBuf,
searched: Vec<PathBuf>,
},
EnvelopeHeaderUnderLegacy {
header: String,
from: PathBuf,
},
LegacyHeaderUnderEnvelopes {
header: String,
from: PathBuf,
},
DepsConfigNotFound {
path: PathBuf,
source: Error,
},
DepsConfigDecode {
path: PathBuf,
message: String,
},
EnvelopeConfigNotFound {
path: PathBuf,
source: Error,
},
EnvelopeConfigDecode {
path: PathBuf,
message: String,
},
CannotReadDirectory {
path: PathBuf,
source: Error,
},
EnvelopeNameConflict {
name: String,
},
DependencyOnUnknownEnvelope {
depending: String,
depended: String,
},
CyclicEnvelopeDependency {
chain: Vec<String>,
},
FileModuleNameConflict {
module: String,
prev: PathBuf,
path: PathBuf,
},
FileModuleNotFound {
module: String,
from: PathBuf,
},
UseOfInsidePackage {
module: String,
from: PathBuf,
},
UnknownPackageDependency {
module: String,
from: PathBuf,
},
}Expand description
Everything that can go wrong while loading a multi-file SATySFi program.
Variants§
Io
Could not read a source file from disk.
Parse
A file failed to parse (lex or grammar error). source carries the
original ParseFileError (span + message) unchanged.
UnresolvedRequire
@require: name could not be resolved to any file on disk.
UnresolvedImport
@import: name could not be resolved to any file on disk.
Cycle
The dependency graph contains a cycle; chain names the files
involved, in traversal order, with the first file repeated at the end
to make the loop explicit (e.g. [a, b, a]).
DocumentAsDependency
A file reached via @require:/@import: is a document (has a body)
rather than a library.
LibraryAsEntry
The entry file is a library (no body) rather than a document.
UnsupportedVersion
opts.version names a SATySFi version this port does not implement
yet (checked before any file is even read).
InvalidModeVersion
LoadMode::Envelopes was requested for a version with no use
headers — the rejected combination. Checked before any file is read.
Fields
version: RustyfiVersionSourceProviderUnderEnvelopes
A crate::SourceProvider was supplied alongside LoadMode::Envelopes.
The Envelopes backend reads its deps/envelope configs through std::fs
directly, so honouring the provider for some reads and not others would
assemble a dependency graph half out of memory and half off the disk.
PackageDependencyUnresolved
use package Mod with no deps config to resolve Mod against
(upstream’s used_as map is empty).
BareUseOutsidePackage
Bare use Mod at document/open level (upstream CannotUseHeaderUse):
a document cannot reach into a package’s internals by module name.
Permanent (not a stub): the closed resolver handles bare use only
inside envelope source trees.
UnresolvedUseOf
use … of `relpath` matched no candidate file on disk.
EnvelopeHeaderUnderLegacy
A use-family header under Legacy mode (the mode that resolves
@require:/@import:). Names the fix.
LegacyHeaderUnderEnvelopes
A Legacy (@require:/@import:) header under Envelopes mode. Names
the fix.
DepsConfigNotFound
The --deps file (rustyfi-deps.yaml) could not be read.
Upstream DepsConfigNotFound, depsConfig.ml:40-45.
DepsConfigDecode
rustyfi-deps.yaml failed to decode or validate — either a
YAML/shape error from serde_yaml or one of the two non-structural
checks (path must be absolute; used_as must be an uppercased
identifier). Upstream DepsConfigError wrapping YamlError
(depsConfig.ml:46-47, yamlDecoder.ml); message carries a
dotted-path context string in the same spirit as upstream’s
show_yaml_context (wording is this port’s own).
EnvelopeConfigNotFound
A rustyfi-envelope.yaml could not be read. Upstream
EnvelopeConfigNotFound, envelopeConfig.ml:142-147.
EnvelopeConfigDecode
A rustyfi-envelope.yaml failed to decode or validate.
Upstream EnvelopeConfigError. Covers the library/font branch
check, opentype_single/opentype_collection branch check, relative
path, lowercased font name, and the 18 markdown_conversion
command/identifier shapes.
CannotReadDirectory
A source_directories entry of an envelope could not be
listed. Upstream CannotReadDirectory, envelopeReader.ml:15-16.
EnvelopeNameConflict
Two deps-config envelopes share a name. Upstream
EnvelopeNameConflict, closedEnvelopeDependencyResolver.ml:50-51.
DependencyOnUnknownEnvelope
An envelope depends on a name absent from the deps config’s
envelope set. Upstream DependencyOnUnknownEnvelope,
closedEnvelopeDependencyResolver.ml:71-76.
CyclicEnvelopeDependency
A cycle in the envelope dependency graph. Upstream
CyclicEnvelopeDependency; chain is names (not paths), the first
element repeated last, matching LoadError::Cycle’s shape.
FileModuleNameConflict
Two source files in one envelope declare the same module
name. Upstream FileModuleNameConflict,
closedFileDependencyResolver.ml:20-22.
FileModuleNotFound
A bare use M inside an envelope names no sibling module.
Upstream FileModuleNotFound, closedFileDependencyResolver.ml:37-41.
UseOfInsidePackage
A use … of header inside an envelope source tree. Upstream
CannotUseHeaderUseOf, closedFileDependencyResolver.ml:51-52.
UnknownPackageDependency
A use package M header whose head matches no used_as alias
in the supplied deps config. Upstream UnknownPackageDependency
(typecheck-side there, load-side here — this port’s loader is the only
header consumer).
Trait Implementations§
Source§impl Error for LoadError
impl Error for LoadError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()