Skip to content

Commit d02f797

Browse files
authored
Merge pull request github#18173 from github/redsun82/rust-windows-flaky-test
Rust: elaborate on `path_to_file_id` comment
2 parents 2a33539 + 9486e8b commit d02f797

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

rust/extractor/src/rust_analyzer.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,11 @@ fn canonicalize_if_on_windows(path: &Path) -> Option<PathBuf> {
198198
}
199199

200200
pub(crate) fn path_to_file_id(path: &Path, vfs: &Vfs) -> Option<FileId> {
201-
// There seems to be some flaky inconsistencies around UNC paths on Windows, so if we fail to
202-
// find the file id for a UNC path like that, we try to canonicalize it using dunce then.
201+
// There seems to be some flaky inconsistencies around paths on Windows, where sometimes paths
202+
// are registered in `vfs` without the `//?/` long path prefix. Then it happens that paths with
203+
// that prefix are not found. To work around that, on Windows after failing to find `path` as
204+
// is, we then try to canonicalize it using dunce. Dunce will be able to losslessly convert a
205+
// `//?/` path into its equivalent one in `vfs` without the prefix, if there is one.
203206
iter::once(path.to_path_buf())
204207
.chain(canonicalize_if_on_windows(path))
205208
.filter_map(|p| {

0 commit comments

Comments
 (0)