From 2826586b91977ce39eb6f82e68abcf7eb0bc6754 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 4 Feb 2022 13:08:21 +1100 Subject: [PATCH] Add a comment about possible mismatches. --- compiler/rustc_metadata/src/locator.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compiler/rustc_metadata/src/locator.rs b/compiler/rustc_metadata/src/locator.rs index 5c81917fc0a82..550b22a2a3c65 100644 --- a/compiler/rustc_metadata/src/locator.rs +++ b/compiler/rustc_metadata/src/locator.rs @@ -399,6 +399,13 @@ impl<'a> CrateLocator<'a> { // of the crate id (path/name/id). // // The goal of this step is to look at as little metadata as possible. + // Unfortunately, the prefix-based matching sometimes is over-eager. + // E.g. if `rlib_suffix` is `libstd` it'll match the file + // `libstd_detect-8d6701fb958915ad.rlib` (incorrect) as well as + // `libstd-f3ab5b1dea981f17.rlib` (correct). But this is hard to avoid + // given that `extra_filename` comes from the `-C extra-filename` + // option and thus can be anything, and the incorrect match will be + // handled safely in `extract_one`. for search_path in self.filesearch.search_paths() { debug!("searching {}", search_path.dir.display()); for spf in search_path.files.iter() {