Skip to main content

library_extensions_by_name

Function library_extensions_by_name 

Source
fn library_extensions_by_name(
    hir: &Hir<'_>,
) -> Rc<HashMap<Symbol, Vec<FunctionId>>>
Expand description

Memoized per-HIR map of library function names to candidate FunctionIds. Building the map requires a full hir.function_ids() scan; without memoization that scan would run on every eligible call site in the program and scale poorly.

Identity is keyed on the Hir<'_> raw pointer. A given lint run sees a single HIR with a stable address, so pointer comparison is safe; we never deref the pointer beyond identity checking. The cache is thread_local, so concurrent project lint workers each maintain their own.