Skip to content

Commit a4a22f0

Browse files
committed
Doc comments
1 parent 434cb43 commit a4a22f0

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

compiler/rustc_session/src/filesearch.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! A module for searching for libraries
2+
13
pub use self::FileMatch::*;
24

35
use std::env;
@@ -14,8 +16,6 @@ pub enum FileMatch {
1416
FileDoesntMatch,
1517
}
1618

17-
// A module for searching for libraries
18-
1919
#[derive(Clone)]
2020
pub struct FileSearch<'a> {
2121
sysroot: &'a Path,
@@ -83,12 +83,12 @@ impl<'a> FileSearch<'a> {
8383
FileSearch { sysroot, triple, search_paths, tlib_path, kind }
8484
}
8585

86-
// Returns just the directories within the search paths.
86+
/// Returns just the directories within the search paths.
8787
pub fn search_path_dirs(&self) -> Vec<PathBuf> {
8888
self.search_paths().map(|sp| sp.dir.to_path_buf()).collect()
8989
}
9090

91-
// Returns a list of directories where target-specific tool binaries are located.
91+
/// Returns a list of directories where target-specific tool binaries are located.
9292
pub fn get_tools_search_paths(&self, self_contained: bool) -> Vec<PathBuf> {
9393
let rustlib_path = rustc_target::target_rustlib_path(self.sysroot, &self.triple);
9494
let p = std::array::IntoIter::new([
@@ -107,8 +107,8 @@ pub fn make_target_lib_path(sysroot: &Path, target_triple: &str) -> PathBuf {
107107
.collect::<PathBuf>()
108108
}
109109

110-
// This function checks if sysroot is found using env::args().next(), and if it
111-
// is not found, uses env::current_exe() to imply sysroot.
110+
/// This function checks if sysroot is found using env::args().next(), and if it
111+
/// is not found, uses env::current_exe() to imply sysroot.
112112
pub fn get_or_default_sysroot() -> PathBuf {
113113
// Follow symlinks. If the resolved path is relative, make it absolute.
114114
fn canonicalize(path: PathBuf) -> PathBuf {

compiler/rustc_session/src/search_paths.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ pub struct SearchPath {
99
pub files: Vec<SearchPathFile>,
1010
}
1111

12-
// The obvious implementation of `SearchPath::files` is a `Vec<PathBuf>`. But
13-
// it is searched repeatedly by `find_library_crate`, and the searches involve
14-
// checking the prefix and suffix of the filename of each `PathBuf`. This is
15-
// doable, but very slow, because it involves calls to `file_name` and
16-
// `extension` that are themselves slow.
17-
//
18-
// This type augments the `PathBuf` with an `Option<String>` containing the
19-
// `PathBuf`'s filename. The prefix and suffix checking is much faster on the
20-
// `Option<String>` than the `PathBuf`. (It's an `Option` because
21-
// `Path::file_name` can fail; if that happens then all subsequent checking
22-
// will also fail, which is fine.)
12+
/// The obvious implementation of `SearchPath::files` is a `Vec<PathBuf>`. But
13+
/// it is searched repeatedly by `find_library_crate`, and the searches involve
14+
/// checking the prefix and suffix of the filename of each `PathBuf`. This is
15+
/// doable, but very slow, because it involves calls to `file_name` and
16+
/// `extension` that are themselves slow.
17+
///
18+
/// This type augments the `PathBuf` with an `Option<String>` containing the
19+
/// `PathBuf`'s filename. The prefix and suffix checking is much faster on the
20+
/// `Option<String>` than the `PathBuf`. (It's an `Option` because
21+
/// `Path::file_name` can fail; if that happens then all subsequent checking
22+
/// will also fail, which is fine.)
2323
#[derive(Clone, Debug)]
2424
pub struct SearchPathFile {
2525
pub path: PathBuf,

0 commit comments

Comments
 (0)