Skip to main content

Module filesearch

Module filesearch 

Source
Expand description

A module for searching for libraries

Re-exportsΒ§

use std::path::Path; πŸ”’
use std::path::PathBuf; πŸ”’
use std::sync::Arc; πŸ”’
use std::env; πŸ”’
use std::env; πŸ”’
use std::fs; πŸ”’
use std::iter; πŸ”’
use rustc_fs_util::try_canonicalize; πŸ”’
use rustc_target::spec::Target; πŸ”’
use crate::search_paths::PathKind; πŸ”’
use crate::search_paths::SearchPath; πŸ”’

StructsΒ§

FileSearch
FileSearchCandidate πŸ”’
This type stores Box<str> instead of PathBuf for the filename, because getting the file_name of a PathBuf allocates, which is unnecessary. We have to go through the files a lot of times, so storing file name and the directory separately saves time and memory.

FunctionsΒ§

current_dll_path πŸ”’
default_sysroot πŸ”’
This function checks if sysroot is found using env::args().next(), and if it is not found, finds sysroot from current rustc_driver dll.
dll_path⚠
Attempts to find the path to the dynamic library containing a function.
make_target_bin_path
Returns a path to the target’s bin folder within its rustlib path in the sysroot. This is where binaries are usually installed, e.g. the self-contained linkers, lld-wrappers, LLVM tools, etc.
make_target_lib_path