PathBuf display doesn't normilize separators

⚓ Rust    📅 2026-05-28    👤 surdeus    👁️ 3      

surdeus

I met an interesting problem in Rust for Windows. I create PathBuf with a content as something:

"C:\Users\anil\RustBuilds/apha_3"

When I use pathbuf.display(), I expect that foreign slashes will be normalized in Windows way. However it doesn't happen. Say more, documentation tells only about possible problems in showing some characters and what a substitute will be used, however nothing about slashes. I think the documentation should be corrected, because I shipped a product with such Rust behavior, and now a customer isn't happy. If I knew about the behavior upfront, I would normalize slashes explicitly.

2 posts - 2 participants

Read full topic

🏷️ Rust_feed