Skip to content

Commit 2826586

Browse files
committedFeb 4, 2022
Add a comment about possible mismatches.
1 parent 2b8d3de commit 2826586

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
 

‎compiler/rustc_metadata/src/locator.rs

+7
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,13 @@ impl<'a> CrateLocator<'a> {
399399
// of the crate id (path/name/id).
400400
//
401401
// The goal of this step is to look at as little metadata as possible.
402+
// Unfortunately, the prefix-based matching sometimes is over-eager.
403+
// E.g. if `rlib_suffix` is `libstd` it'll match the file
404+
// `libstd_detect-8d6701fb958915ad.rlib` (incorrect) as well as
405+
// `libstd-f3ab5b1dea981f17.rlib` (correct). But this is hard to avoid
406+
// given that `extra_filename` comes from the `-C extra-filename`
407+
// option and thus can be anything, and the incorrect match will be
408+
// handled safely in `extract_one`.
402409
for search_path in self.filesearch.search_paths() {
403410
debug!("searching {}", search_path.dir.display());
404411
for spf in search_path.files.iter() {

0 commit comments

Comments
 (0)
Please sign in to comment.