pub trait ItemIndex: Copy + Default + Debug + Display + PartialEq + PartialOrd + From<u32> + Into<u32> {
    fn is_cross_module(self) -> bool { ... }
}
Expand description

An index into either the TypeInformation or IdInformation stream.

Provided Methods

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:

  1. Look up the index in CrossModuleImports of the current module.
  2. Use StringTable to resolve the name of the referenced module.
  3. Find the Module with the same module name and load its ModuleInfo. Note that this comparison needs to be done case-insensitively as the name in the DBI stream and name table are known to not have matching cases.
  4. Resolve the Local index into a global one using CrossModuleExports.

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.

Implementors