Skip to main content

canonical_path

Function canonical_path 

Source
pub fn canonical_path(path: &Path) -> PathBuf
Expand description

Canonicalize path, memoized process-wide.

Module-graph construction and every per-file graph query canonicalize paths to dedupe import-edge spellings, and the check preflight scan canonicalizes each visited module per checked file. Path::canonicalize resolves every component through the kernel, so a whole-tree harn check used to spend the bulk of its wall clock in path-resolution syscalls (getattrlist dominated system time). One positive-result memo removes the O(files x import closure) repetition; failed canonicalizations are not memoized (mirroring the bytecode cache’s canonicalize_cached) so a file that appears later still resolves correctly in long-lived processes. <std>/ virtual paths pass through untouched.