I tried this code (on Windows):
use std::{
hash::{BuildHasher, RandomState},
path::Path,
};
fn main() {
let path1 = Path::new(r"\\?\C:/foo");
let path2 = Path::new(r"\\?\C:\foo");
let hasher = RandomState::new();
println!("{path1:?} == {path2:?}: {}", path1 == path2);
println!(
"hash({path1:?}) == hash({path2:?}): {}",
hasher.hash_one(path1) == hasher.hash_one(path2)
);
}
I expected to see this happen:
"\\\\?\\C:/foo" == "\\\\?\\C:\\foo": false
hash("\\\\?\\C:/foo") == hash("\\\\?\\C:\\foo"): false
i.e paths to not be equal, since these are UNC paths that should not be normalized.
Instead, this happened:
"\\\\?\\C:/foo" == "\\\\?\\C:\\foo": true
hash("\\\\?\\C:/foo") == hash("\\\\?\\C:\\foo"): false
This violates the requirement that if two values of a type are equal, their corresponding hashes should be equal.
Meta
rustc --version --verbose:
rustc 1.100.0-nightly (fb6531d55 2026-08-23)
binary: rustc
commit-hash: fb6531d550e0075b9eb9a51464f404805eec87d9
commit-date: 2026-08-23
host: aarch64-pc-windows-msvc
release: 1.100.0-nightly
LLVM version: 23.1.0
I tried this code (on Windows):
I expected to see this happen:
i.e paths to not be equal, since these are UNC paths that should not be normalized.
Instead, this happened:
This violates the requirement that if two values of a type are equal, their corresponding hashes should be equal.
Meta
rustc --version --verbose: