-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
I'd expect the path to be normalized to "/a/b"
since that is a substring of "///a/b"
.
On some Unix implementations a leading //
is special, but the Unix and POSIX specs state that a leading ///
is equivalent to just one /
. On Linux, //
is also the same as /
, though it has been proposed for that to change.
Stack Exchange: On what systems is //foo/bar different from /foo/bar?
use std::path::Path;
fn main() {
let expected = "/a/b";
let actual = Path::new("///a/b").components().as_path().to_str().unwrap();
assert_eq!(expected, actual);
}
Errors:
Compiling playground v0.0.1 (/playground)
Finished release [optimized] target(s) in 3.78s
Running `target/release/playground`
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `"/a/b"`,
right: `"///a/b"`', src/main.rs:6:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Metadata
Metadata
Assignees
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.