pub trait ItemIndex: Copy + Default + Debug + Display + PartialEq<Self> + PartialOrd<Self> + From<u32> + Into<u32> {
fn is_cross_module(self) -> bool { ... }
}
Expand description
An index into either the TypeInformation
or
IdInformation
stream.
Provided methods
fn is_cross_module(self) -> bool
fn is_cross_module(self) -> bool
Returns true
if this is a cross module reference.
When compiling with LTO, the compiler may reference types and ids across modules. In such cases, a lookup in the global streams will not succeed. Instead, the import must be resolved using cross module references:
- Look up the index in
CrossModuleImports
of the current module. - Use
StringTable
to resolve the name of the referenced module. - Find the
Module
with the same module name and load itsModuleInfo
. - Resolve the
Local
index into a global one usingCrossModuleExports
.
Cross module references are specially formatted indexes with the most significant bit set to
1
. The remaining bits are divided into a module and index offset into the
CrossModuleImports
section.