1
Fork 0

Doc comments

This commit is contained in:
bjorn3 2021-08-31 18:31:29 +02:00
parent 434cb437b5
commit a4a22f07d7
2 changed files with 17 additions and 17 deletions

View file

@ -1,3 +1,5 @@
//! A module for searching for libraries
pub use self::FileMatch::*;
use std::env;
@ -14,8 +16,6 @@ pub enum FileMatch {
FileDoesntMatch,
}
// A module for searching for libraries
#[derive(Clone)]
pub struct FileSearch<'a> {
sysroot: &'a Path,
@ -83,12 +83,12 @@ impl<'a> FileSearch<'a> {
FileSearch { sysroot, triple, search_paths, tlib_path, kind }
}
// Returns just the directories within the search paths.
/// Returns just the directories within the search paths.
pub fn search_path_dirs(&self) -> Vec<PathBuf> {
self.search_paths().map(|sp| sp.dir.to_path_buf()).collect()
}
// Returns a list of directories where target-specific tool binaries are located.
/// Returns a list of directories where target-specific tool binaries are located.
pub fn get_tools_search_paths(&self, self_contained: bool) -> Vec<PathBuf> {
let rustlib_path = rustc_target::target_rustlib_path(self.sysroot, &self.triple);
let p = std::array::IntoIter::new([
@ -107,8 +107,8 @@ pub fn make_target_lib_path(sysroot: &Path, target_triple: &str) -> PathBuf {
.collect::<PathBuf>()
}
// This function checks if sysroot is found using env::args().next(), and if it
// is not found, uses env::current_exe() to imply sysroot.
/// This function checks if sysroot is found using env::args().next(), and if it
/// is not found, uses env::current_exe() to imply sysroot.
pub fn get_or_default_sysroot() -> PathBuf {
// Follow symlinks. If the resolved path is relative, make it absolute.
fn canonicalize(path: PathBuf) -> PathBuf {