Skip to content

Commit 1a5a77c

Browse files
committed
---
yaml --- r: 186218 b: refs/heads/try c: 70ecd8e h: refs/heads/master v: v3
1 parent f9d2275 commit 1a5a77c

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: b4c965ee803a4521d8b4575f634e036f93e408f3
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 3a96d6a9818fe2affc98a187fb1065120458cee9
5-
refs/heads/try: d0029a47c274a2ce97641b80ba34cf6fbfa2d73e
5+
refs/heads/try: 70ecd8ed38d5bedbeb281d78c3da44477764236a
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/libstd/path.rs

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ mod platform {
156156
None
157157
}
158158

159-
#[derive(Copy, Clone, Show, Hash, PartialEq, Eq)]
159+
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
160160
pub struct Prefix<'a>;
161161

162162
impl<'a> Prefix<'a> {
@@ -177,9 +177,10 @@ mod platform {
177177
mod platform {
178178
use core::prelude::*;
179179

180-
use super::{Path, os_str_as_u8_slice, u8_slice_as_os_str};
181-
use ffi::OsStr;
180+
use char::CharExt as UnicodeCharExt;
181+
use super::{os_str_as_u8_slice, u8_slice_as_os_str};
182182
use ascii::*;
183+
use ffi::OsStr;
183184

184185
#[inline]
185186
pub fn is_sep(b: u8) -> bool {
@@ -299,7 +300,7 @@ mod platform {
299300
pub fn len(&self) -> usize {
300301
use self::Prefix::*;
301302
fn os_str_len(s: &OsStr) -> usize {
302-
unsafe { os_str_as_u8_slice(s).len() }
303+
os_str_as_u8_slice(s).len()
303304
}
304305
match *self {
305306
Verbatim(x) => 4 + os_str_len(x),
@@ -339,12 +340,12 @@ mod platform {
339340
}
340341
}
341342

342-
impl<'a> ops::PartialEq for Prefix<'a> {
343+
impl<'a> PartialEq for Prefix<'a> {
343344
fn eq(&self, other: &Prefix<'a>) -> bool {
344345
use self::Prefix::*;
345346
match (*self, *other) {
346347
(Verbatim(x), Verbatim(y)) => x == y,
347-
(VerbatimUNC(x1, x2), Verbatim(y1, y2)) => x1 == y1 && x2 == y2,
348+
(VerbatimUNC(x1, x2), VerbatimUNC(y1, y2)) => x1 == y1 && x2 == y2,
348349
(VerbatimDisk(x), VerbatimDisk(y)) =>
349350
os_str_as_u8_slice(x).eq_ignore_ascii_case(os_str_as_u8_slice(y)),
350351
(DeviceNS(x), DeviceNS(y)) => x == y,
@@ -457,7 +458,7 @@ fn split_file_at_dot(file: &OsStr) -> (Option<&OsStr>, Option<&OsStr>) {
457458
/// Going front to back, a path is made up of a prefix, a root component, a body
458459
/// (of normal components), and a suffix/emptycomponent (normalized `.` or ``
459460
/// for a path ending with the separator)
460-
#[derive(Copy, Clone, PartialEq, PartialOrd, Show)]
461+
#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
461462
enum State {
462463
Prefix = 0, // c:
463464
Root = 1, // /
@@ -470,7 +471,7 @@ enum State {
470471
///
471472
/// See the module documentation for an in-depth explanation of components and
472473
/// their role in the API.
473-
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Show)]
474+
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
474475
pub enum Component<'a> {
475476
/// A Windows path prefix, e.g. `C:` or `\server\share`
476477
Prefix(&'a OsStr),
@@ -2434,12 +2435,21 @@ mod tests {
24342435
tfn!("foo", "bar", "bar");
24352436
tfn!("foo", "", "");
24362437
tfn!("", "foo", "foo");
2437-
tfn!(".", "foo", "./foo");
2438-
tfn!("foo/", "bar", "foo/bar");
2439-
tfn!("foo/.", "bar", "foo/./bar");
2440-
tfn!("..", "foo", "../foo");
2441-
tfn!("foo/..", "bar", "foo/../bar");
2442-
tfn!("/", "foo", "/foo");
2438+
if cfg!(unix) {
2439+
tfn!(".", "foo", "./foo");
2440+
tfn!("foo/", "bar", "foo/bar");
2441+
tfn!("foo/.", "bar", "foo/./bar");
2442+
tfn!("..", "foo", "../foo");
2443+
tfn!("foo/..", "bar", "foo/../bar");
2444+
tfn!("/", "foo", "/foo");
2445+
} else {
2446+
tfn!(".", "foo", r".\foo");
2447+
tfn!(r"foo\", "bar", r"foo\bar");
2448+
tfn!(r"foo\.", "bar", r"foo\.\bar");
2449+
tfn!("..", "foo", r"..\foo");
2450+
tfn!(r"foo\..", "bar", r"foo\..\bar");
2451+
tfn!(r"\", "foo", r"\foo");
2452+
}
24432453
}
24442454

24452455
#[test]

0 commit comments

Comments
 (0)