Skip to main content

visible_modules

Function visible_modules 

Source
pub fn visible_modules(
    package: &ResolvedPackage,
    local_modules: &[LocalModule],
    dependencies: &[DependencyModules<'_>],
) -> Result<HashMap<Name, ModuleOrigin>, Vec<Error>>
Expand description

Every module name the package being compiled can import, and what each one names.

The map holds one entry per spelling: the package’s own modules under their own names, a wrapped dependency’s under <Namespace>.<module>, and an unwrapped dependency’s under their own names. That is the whole of what an import can reach — Imports across a package boundary — and a module has exactly one spelling in it, never two.

A name claimed twice is an error and no map comes back, because there is no coherent answer to give the modules about to be compiled. Every collision is reported, not just the first.