Skip to main content

normalize_selector

Function normalize_selector 

Source
fn normalize_selector<'a>(builder: &Builder<'_>, path: &'a Path) -> &'a Path
Expand description

Normalize command-line arguments that happen to be paths, e.g.:

  • /home/ferris/rust/tests/ui/asm/cfg.rs => tests/ui/asm/cfg.rs
  • ./tests/ui/asm/cfg.rs => tests/ui/asm/cfg.rs

Normalization is performed relative to the repository source root, not the working directory.

We take care to only modify selectors that specifically resemble paths, and to only modify selectors that actually correspond to a file on disk. This avoids incorrect conversions such as:

  • /home/ferris/rust/ui =X=> ui
  • ./tidyselftest =X=> tidyselftest