pub trait DepResolver: Send + Sync {
// Required method
fn resolve_modules(
&self,
stages: &[Stage],
head_op: Option<&str>,
) -> BTreeMap<String, Ty>;
// Provided methods
fn resolve_module_types(
&self,
_stages: &[Stage],
_head_op: Option<&str>,
) -> BTreeMap<String, Vec<TypeDecl>> { ... }
fn resolve_module_prefixes(
&self,
_stages: &[Stage],
_head_op: Option<&str>,
) -> BTreeMap<String, String> { ... }
}Expand description
Resolves a head’s external (registry/git) dependencies to their public
module signatures, so the write-time gate can type-check a head that keeps
import "<pkg>/mod" as <alias> edges instead of inlining the dependency
(#930). The returned map is keyed by import reference ("lex-nt/lib") →
that dependency module’s record type (as crate::render::module_record_at_op
or a source-based equivalent produces), exactly the shape
lex_types::check_program_with_modules consumes.
Implementations differ by context and live in the crate that has the
resolution machinery: the client (lex publish) resolves from the
working-copy lex.lock + local package cache; the hub resolves from the
committed lock + its own hosted stores (cross-tenant), which a single
Store cannot reach on its own. When no resolver is installed the gate
resolves an empty map — only stdlib binds and any external reference is an
unbound-name error, exactly as before #930 (so inlined heads, which carry
no external edges, are unaffected).
Required Methods§
Sourcefn resolve_modules(
&self,
stages: &[Stage],
head_op: Option<&str>,
) -> BTreeMap<String, Ty>
fn resolve_modules( &self, stages: &[Stage], head_op: Option<&str>, ) -> BTreeMap<String, Ty>
head_op is the op the head is known by when the gate has one (merge,
patch and hub-verify reconstruct a committed head); None for a
candidate not yet committed (publish), where the client resolver
falls back to the working-copy lock.
Provided Methods§
Sourcefn resolve_module_types(
&self,
_stages: &[Stage],
_head_op: Option<&str>,
) -> BTreeMap<String, Vec<TypeDecl>>
fn resolve_module_types( &self, _stages: &[Stage], _head_op: Option<&str>, ) -> BTreeMap<String, Vec<TypeDecl>>
The resolved dependencies’ exported type declarations, keyed by the
same import reference as Self::resolve_modules (#930 completeness).
The write-time gate registers these under each import’s alias so a head
that references a dependency’s type — not just its functions — checks.
Defaulted to empty so existing resolvers keep compiling and simply resolve function signatures only (their previous behavior); a resolver that can supply type declarations overrides this.
Sourcefn resolve_module_prefixes(
&self,
_stages: &[Stage],
_head_op: Option<&str>,
) -> BTreeMap<String, String>
fn resolve_module_prefixes( &self, _stages: &[Stage], _head_op: Option<&str>, ) -> BTreeMap<String, String>
Each resolved dependency import’s module mangle prefix, keyed by the
same import reference (#963). When a dependency is resolved as a whole
package, its exported types are named by their path-derived prefix
(error_<hash>.DbErr); this lets the write-time gate map the import
alias to that prefix so an alias-qualified type reference (e.DbErr)
resolves to the same type the dependency’s own signatures name.
Defaulted to empty: a resolver that returns bare (alias-qualified) type names supplies none, and the gate keeps the #930 alias-qualification path.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".