Skip to content

Commit c64a884

Browse files
committed
---
yaml --- r: 81605 b: refs/heads/snap-stage3 c: c16d7a4 h: refs/heads/master i: 81603: fd70f6e v: v3
1 parent 19e333e commit c64a884

File tree

3 files changed

+78
-78
lines changed

3 files changed

+78
-78
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 4c6bf4872012c010f84dc7fa2cdfe87522533f89
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: f25835c2210295bed25096807eed201e4d3b206e
4+
refs/heads/snap-stage3: c16d7a439441ecfb8ac53deee070bb616fdc759e
55
refs/heads/try: 70152ff55722878cde684ee6462c14c65f2c4729
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libstd/path2/posix.rs

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ impl GenericPath for Path {
271271
}
272272
}
273273
}
274-
Some(Path::new(comps.connect_vec(&sep)))
274+
Some(Path::from_vec(comps.connect_vec(&sep)))
275275
}
276276
}
277277
}
@@ -283,7 +283,7 @@ impl Path {
283283
///
284284
/// Raises the `null_byte` condition if the vector contains a NUL.
285285
#[inline]
286-
pub fn new(v: &[u8]) -> Path {
286+
pub fn from_vec(v: &[u8]) -> Path {
287287
GenericPath::from_vec(v)
288288
}
289289

@@ -433,12 +433,12 @@ mod tests {
433433

434434
#[test]
435435
fn test_paths() {
436-
t!(v: Path::new([]), b!("."));
437-
t!(v: Path::new(b!("/")), b!("/"));
438-
t!(v: Path::new(b!("a/b/c")), b!("a/b/c"));
439-
t!(v: Path::new(b!("a/b/c", 0xff)), b!("a/b/c", 0xff));
440-
t!(v: Path::new(b!(0xff, "/../foo", 0x80)), b!("foo", 0x80));
441-
let p = Path::new(b!("a/b/c", 0xff));
436+
t!(v: Path::from_vec([]), b!("."));
437+
t!(v: Path::from_vec(b!("/")), b!("/"));
438+
t!(v: Path::from_vec(b!("a/b/c")), b!("a/b/c"));
439+
t!(v: Path::from_vec(b!("a/b/c", 0xff)), b!("a/b/c", 0xff));
440+
t!(v: Path::from_vec(b!(0xff, "/../foo", 0x80)), b!("foo", 0x80));
441+
let p = Path::from_vec(b!("a/b/c", 0xff));
442442
assert_eq!(p.as_str(), None);
443443

444444
t!(s: Path::from_str(""), ".");
@@ -464,15 +464,15 @@ mod tests {
464464
t!(s: Path::from_str("foo/../../.."), "../..");
465465
t!(s: Path::from_str("foo/../../bar"), "../bar");
466466

467-
assert_eq!(Path::new(b!("foo/bar")).into_vec(), b!("foo/bar").to_owned());
468-
assert_eq!(Path::new(b!("/foo/../../bar")).into_vec(),
467+
assert_eq!(Path::from_vec(b!("foo/bar")).into_vec(), b!("foo/bar").to_owned());
468+
assert_eq!(Path::from_vec(b!("/foo/../../bar")).into_vec(),
469469
b!("/bar").to_owned());
470470
assert_eq!(Path::from_str("foo/bar").into_str(), Some(~"foo/bar"));
471471
assert_eq!(Path::from_str("/foo/../../bar").into_str(), Some(~"/bar"));
472472
473-
let p = Path::new(b!("foo/bar", 0x80));
473+
let p = Path::from_vec(b!("foo/bar", 0x80));
474474
assert_eq!(p.as_str(), None);
475-
assert_eq!(Path::new(b!("foo", 0xff, "/bar")).into_str(), None);
475+
assert_eq!(Path::from_vec(b!("foo", 0xff, "/bar")).into_str(), None);
476476
}
477477
478478
#[test]
@@ -485,7 +485,7 @@ mod tests {
485485
assert_eq!(v.as_slice(), b!("foo/bar", 0));
486486
(b!("/bar").to_owned())
487487
}).inside {
488-
Path::new(b!("foo/bar", 0))
488+
Path::from_vec(b!("foo/bar", 0))
489489
};
490490
assert!(handled);
491491
assert_eq!(p.as_vec(), b!("/bar"));
@@ -541,16 +541,16 @@ mod tests {
541541
)
542542
)
543543
544-
t!(~"new() w/nul" => {
544+
t!(~"from_vec() w/nul" => {
545545
do cond.trap(|_| {
546546
(b!("null", 0).to_owned())
547547
}).inside {
548-
Path::new(b!("foo/bar", 0))
548+
Path::from_vec(b!("foo/bar", 0))
549549
};
550550
})
551551
552552
t!(~"set_filename w/nul" => {
553-
let mut p = Path::new(b!("foo/bar"));
553+
let mut p = Path::from_vec(b!("foo/bar"));
554554
do cond.trap(|_| {
555555
(b!("null", 0).to_owned())
556556
}).inside {
@@ -559,7 +559,7 @@ mod tests {
559559
})
560560
561561
t!(~"set_dirname w/nul" => {
562-
let mut p = Path::new(b!("foo/bar"));
562+
let mut p = Path::from_vec(b!("foo/bar"));
563563
do cond.trap(|_| {
564564
(b!("null", 0).to_owned())
565565
}).inside {
@@ -568,7 +568,7 @@ mod tests {
568568
})
569569
570570
t!(~"push w/nul" => {
571-
let mut p = Path::new(b!("foo/bar"));
571+
let mut p = Path::from_vec(b!("foo/bar"));
572572
do cond.trap(|_| {
573573
(b!("null", 0).to_owned())
574574
}).inside {
@@ -595,7 +595,7 @@ mod tests {
595595
);
596596
(v: $path:expr, $op:ident, $exp:expr) => (
597597
{
598-
let path = Path::new($path);
598+
let path = Path::from_vec($path);
599599
assert_eq!(path.$op(), $exp);
600600
}
601601
)
@@ -715,15 +715,15 @@ mod tests {
715715
);
716716
(v: [$($path:expr),+], [$($left:expr),+], Some($($right:expr),+)) => (
717717
{
718-
let mut p = Path::new(b!($($path),+));
718+
let mut p = Path::from_vec(b!($($path),+));
719719
let file = p.pop_opt();
720720
assert_eq!(p.as_vec(), b!($($left),+));
721721
assert_eq!(file.map(|v| v.as_slice()), Some(b!($($right),+)));
722722
}
723723
);
724724
(v: [$($path:expr),+], [$($left:expr),+], None) => (
725725
{
726-
let mut p = Path::new(b!($($path),+));
726+
let mut p = Path::from_vec(b!($($path),+));
727727
let file = p.pop_opt();
728728
assert_eq!(p.as_vec(), b!($($left),+));
729729
assert_eq!(file, None);
@@ -746,15 +746,15 @@ mod tests {
746746
t!(s: "/a", "/", Some("a"));
747747
t!(s: "/", "/", None);
748748
749-
assert_eq!(Path::new(b!("foo/bar", 0x80)).pop_opt_str(), None);
750-
assert_eq!(Path::new(b!("foo", 0x80, "/bar")).pop_opt_str(), Some(~"bar"));
749+
assert_eq!(Path::from_vec(b!("foo/bar", 0x80)).pop_opt_str(), None);
750+
assert_eq!(Path::from_vec(b!("foo", 0x80, "/bar")).pop_opt_str(), Some(~"bar"));
751751
}
752752
753753
#[test]
754754
fn test_join() {
755-
t!(v: Path::new(b!("a/b/c")).join(b!("..")), b!("a/b"));
756-
t!(v: Path::new(b!("/a/b/c")).join(b!("d")), b!("/a/b/c/d"));
757-
t!(v: Path::new(b!("a/", 0x80, "/c")).join(b!(0xff)), b!("a/", 0x80, "/c/", 0xff));
755+
t!(v: Path::from_vec(b!("a/b/c")).join(b!("..")), b!("a/b"));
756+
t!(v: Path::from_vec(b!("/a/b/c")).join(b!("d")), b!("/a/b/c/d"));
757+
t!(v: Path::from_vec(b!("a/", 0x80, "/c")).join(b!(0xff)), b!("a/", 0x80, "/c/", 0xff));
758758
t!(s: Path::from_str("a/b/c").join_str(".."), "a/b");
759759
t!(s: Path::from_str("/a/b/c").join_str("d"), "/a/b/c/d");
760760
t!(s: Path::from_str("a/b").join_str("c/d"), "a/b/c/d");
@@ -786,10 +786,10 @@ mod tests {
786786
787787
#[test]
788788
fn test_with_helpers() {
789-
t!(v: Path::new(b!("a/b/c")).with_dirname(b!("d")), b!("d/c"));
790-
t!(v: Path::new(b!("a/b/c")).with_dirname(b!("d/e")), b!("d/e/c"));
791-
t!(v: Path::new(b!("a/", 0x80, "b/c")).with_dirname(b!(0xff)), b!(0xff, "/c"));
792-
t!(v: Path::new(b!("a/b/", 0x80)).with_dirname(b!("/", 0xcd)),
789+
t!(v: Path::from_vec(b!("a/b/c")).with_dirname(b!("d")), b!("d/c"));
790+
t!(v: Path::from_vec(b!("a/b/c")).with_dirname(b!("d/e")), b!("d/e/c"));
791+
t!(v: Path::from_vec(b!("a/", 0x80, "b/c")).with_dirname(b!(0xff)), b!(0xff, "/c"));
792+
t!(v: Path::from_vec(b!("a/b/", 0x80)).with_dirname(b!("/", 0xcd)),
793793
b!("/", 0xcd, "/", 0x80));
794794
t!(s: Path::from_str("a/b/c").with_dirname_str("d"), "d/c");
795795
t!(s: Path::from_str("a/b/c").with_dirname_str("d/e"), "d/e/c");
@@ -807,9 +807,9 @@ mod tests {
807807
t!(s: Path::from_str("foo").with_dirname_str(".."), "../foo");
808808
t!(s: Path::from_str("foo").with_dirname_str("../.."), "../../foo");
809809
810-
t!(v: Path::new(b!("a/b/c")).with_filename(b!("d")), b!("a/b/d"));
811-
t!(v: Path::new(b!("a/b/c", 0xff)).with_filename(b!(0x80)), b!("a/b/", 0x80));
812-
t!(v: Path::new(b!("/", 0xff, "/foo")).with_filename(b!(0xcd)),
810+
t!(v: Path::from_vec(b!("a/b/c")).with_filename(b!("d")), b!("a/b/d"));
811+
t!(v: Path::from_vec(b!("a/b/c", 0xff)).with_filename(b!(0x80)), b!("a/b/", 0x80));
812+
t!(v: Path::from_vec(b!("/", 0xff, "/foo")).with_filename(b!(0xcd)),
813813
b!("/", 0xff, "/", 0xcd));
814814
t!(s: Path::from_str("a/b/c").with_filename_str("d"), "a/b/d");
815815
t!(s: Path::from_str(".").with_filename_str("foo"), "foo");
@@ -831,12 +831,12 @@ mod tests {
831831
t!(s: Path::from_str("..").with_filename_str(""), "..");
832832
t!(s: Path::from_str("../..").with_filename_str(""), "../..");
833833
834-
t!(v: Path::new(b!("hi/there", 0x80, ".txt")).with_filestem(b!(0xff)),
834+
t!(v: Path::from_vec(b!("hi/there", 0x80, ".txt")).with_filestem(b!(0xff)),
835835
b!("hi/", 0xff, ".txt"));
836-
t!(v: Path::new(b!("hi/there.txt", 0x80)).with_filestem(b!(0xff)),
836+
t!(v: Path::from_vec(b!("hi/there.txt", 0x80)).with_filestem(b!(0xff)),
837837
b!("hi/", 0xff, ".txt", 0x80));
838-
t!(v: Path::new(b!("hi/there", 0xff)).with_filestem(b!(0x80)), b!("hi/", 0x80));
839-
t!(v: Path::new(b!("hi", 0x80, "/there")).with_filestem([]), b!("hi", 0x80));
838+
t!(v: Path::from_vec(b!("hi/there", 0xff)).with_filestem(b!(0x80)), b!("hi/", 0x80));
839+
t!(v: Path::from_vec(b!("hi", 0x80, "/there")).with_filestem([]), b!("hi", 0x80));
840840
t!(s: Path::from_str("hi/there.txt").with_filestem_str("here"), "hi/here.txt");
841841
t!(s: Path::from_str("hi/there.txt").with_filestem_str(""), "hi/.txt");
842842
t!(s: Path::from_str("hi/there.txt").with_filestem_str("."), "hi/..txt");
@@ -859,13 +859,13 @@ mod tests {
859859
t!(s: Path::from_str("hi/there..").with_filestem_str("here"), "hi/here.");
860860
t!(s: Path::from_str("hi/there..").with_filestem_str(""), "hi");
861861
862-
t!(v: Path::new(b!("hi/there", 0x80, ".txt")).with_extension(b!("exe")),
862+
t!(v: Path::from_vec(b!("hi/there", 0x80, ".txt")).with_extension(b!("exe")),
863863
b!("hi/there", 0x80, ".exe"));
864-
t!(v: Path::new(b!("hi/there.txt", 0x80)).with_extension(b!(0xff)),
864+
t!(v: Path::from_vec(b!("hi/there.txt", 0x80)).with_extension(b!(0xff)),
865865
b!("hi/there.", 0xff));
866-
t!(v: Path::new(b!("hi/there", 0x80)).with_extension(b!(0xff)),
866+
t!(v: Path::from_vec(b!("hi/there", 0x80)).with_extension(b!(0xff)),
867867
b!("hi/there", 0x80, ".", 0xff));
868-
t!(v: Path::new(b!("hi/there.", 0xff)).with_extension([]), b!("hi/there"));
868+
t!(v: Path::from_vec(b!("hi/there.", 0xff)).with_extension([]), b!("hi/there"));
869869
t!(s: Path::from_str("hi/there.txt").with_extension_str("exe"), "hi/there.exe");
870870
t!(s: Path::from_str("hi/there.txt").with_extension_str(""), "hi/there");
871871
t!(s: Path::from_str("hi/there.txt").with_extension_str("."), "hi/there..");
@@ -899,9 +899,9 @@ mod tests {
899899
{
900900
let path = $path;
901901
let arg = $arg;
902-
let mut p1 = Path::new(path);
902+
let mut p1 = Path::from_vec(path);
903903
p1.$set(arg);
904-
let p2 = Path::new(path);
904+
let p2 = Path::from_vec(path);
905905
assert_eq!(p1, p2.$with(arg));
906906
}
907907
)
@@ -968,9 +968,9 @@ mod tests {
968968
)
969969
)
970970
971-
t!(v: Path::new(b!("a/b/c")), b!("c"), b!("a/b"), b!("c"), None);
972-
t!(v: Path::new(b!("a/b/", 0xff)), b!(0xff), b!("a/b"), b!(0xff), None);
973-
t!(v: Path::new(b!("hi/there.", 0xff)), b!("there.", 0xff), b!("hi"),
971+
t!(v: Path::from_vec(b!("a/b/c")), b!("c"), b!("a/b"), b!("c"), None);
972+
t!(v: Path::from_vec(b!("a/b/", 0xff)), b!(0xff), b!("a/b"), b!(0xff), None);
973+
t!(v: Path::from_vec(b!("hi/there.", 0xff)), b!("there.", 0xff), b!("hi"),
974974
b!("there"), Some(b!(0xff)));
975975
t!(s: Path::from_str("a/b/c"), Some("c"), Some("a/b"), Some("c"), None);
976976
t!(s: Path::from_str("."), Some(""), Some("."), Some(""), None);
@@ -985,16 +985,16 @@ mod tests {
985985
t!(s: Path::from_str("hi/.there"), Some(".there"), Some("hi"), Some(".there"), None);
986986
t!(s: Path::from_str("hi/..there"), Some("..there"), Some("hi"),
987987
Some("."), Some("there"));
988-
t!(s: Path::new(b!("a/b/", 0xff)), None, Some("a/b"), None, None);
989-
t!(s: Path::new(b!("a/b/", 0xff, ".txt")), None, Some("a/b"), None, Some("txt"));
990-
t!(s: Path::new(b!("a/b/c.", 0x80)), None, Some("a/b"), Some("c"), None);
991-
t!(s: Path::new(b!(0xff, "/b")), Some("b"), None, Some("b"), None);
988+
t!(s: Path::from_vec(b!("a/b/", 0xff)), None, Some("a/b"), None, None);
989+
t!(s: Path::from_vec(b!("a/b/", 0xff, ".txt")), None, Some("a/b"), None, Some("txt"));
990+
t!(s: Path::from_vec(b!("a/b/c.", 0x80)), None, Some("a/b"), Some("c"), None);
991+
t!(s: Path::from_vec(b!(0xff, "/b")), Some("b"), None, Some("b"), None);
992992
}
993993
994994
#[test]
995995
fn test_dir_file_path() {
996-
t!(v: Path::new(b!("hi/there", 0x80)).dir_path(), b!("hi"));
997-
t!(v: Path::new(b!("hi", 0xff, "/there")).dir_path(), b!("hi", 0xff));
996+
t!(v: Path::from_vec(b!("hi/there", 0x80)).dir_path(), b!("hi"));
997+
t!(v: Path::from_vec(b!("hi", 0xff, "/there")).dir_path(), b!("hi", 0xff));
998998
t!(s: Path::from_str("hi/there").dir_path(), "hi");
999999
t!(s: Path::from_str("hi").dir_path(), ".");
10001000
t!(s: Path::from_str("/hi").dir_path(), "/");
@@ -1019,8 +1019,8 @@ mod tests {
10191019
)
10201020
)
10211021
1022-
t!(v: Path::new(b!("hi/there", 0x80)).file_path(), Some(b!("there", 0x80)));
1023-
t!(v: Path::new(b!("hi", 0xff, "/there")).file_path(), Some(b!("there")));
1022+
t!(v: Path::from_vec(b!("hi/there", 0x80)).file_path(), Some(b!("there", 0x80)));
1023+
t!(v: Path::from_vec(b!("hi", 0xff, "/there")).file_path(), Some(b!("there")));
10241024
t!(s: Path::from_str("hi/there").file_path(), Some("there"));
10251025
t!(s: Path::from_str("hi").file_path(), Some("hi"));
10261026
t!(s: Path::from_str(".").file_path(), None);
@@ -1134,7 +1134,7 @@ mod tests {
11341134
);
11351135
(v: [$($arg:expr),+], [$([$($exp:expr),*]),*]) => (
11361136
{
1137-
let path = Path::new(b!($($arg),+));
1137+
let path = Path::from_vec(b!($($arg),+));
11381138
let comps = path.component_iter().to_owned_vec();
11391139
let exp: &[&[u8]] = [$(b!($($exp),*)),*];
11401140
assert_eq!(comps.as_slice(), exp);

0 commit comments

Comments
 (0)