Skip to content

Commit 661399c

Browse files
committed
---
yaml --- r: 148954 b: refs/heads/try2 c: 544cb42 h: refs/heads/master v: v3
1 parent b56d22e commit 661399c

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: b0b89a57d5d548155d8a37f5e4b9f11a471bb075
8+
refs/heads/try2: 544cb42d7aeaec230e10471820f48e561e3cd33d
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libstd/path/mod.rs

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -547,10 +547,10 @@ impl<'a, P: GenericPath> ToStr for Display<'a, P> {
547547
if self.filename {
548548
match self.path.filename() {
549549
None => ~"",
550-
Some(v) => from_utf8_with_replacement(v)
550+
Some(v) => str::from_utf8_lossy(v)
551551
}
552552
} else {
553-
from_utf8_with_replacement(self.path.as_vec())
553+
str::from_utf8_lossy(self.path.as_vec())
554554
}
555555
}
556556
}
@@ -635,29 +635,6 @@ fn contains_nul(v: &[u8]) -> bool {
635635
v.iter().any(|&x| x == 0)
636636
}
637637

638-
#[inline(always)]
639-
fn from_utf8_with_replacement(mut v: &[u8]) -> ~str {
640-
// FIXME (#9516): Don't decode utf-8 manually here once we have a good way to do it in str
641-
// This is a truly horrifically bad implementation, done as a functionality stopgap until
642-
// we have a proper utf-8 decoder. I don't really want to write one here.
643-
static REPLACEMENT_CHAR: char = '\uFFFD';
644-
645-
let mut s = str::with_capacity(v.len());
646-
while !v.is_empty() {
647-
let w = str::utf8_char_width(v[0]);
648-
if w == 0u {
649-
s.push_char(REPLACEMENT_CHAR);
650-
v = v.slice_from(1);
651-
} else if v.len() < w || !str::is_utf8(v.slice_to(w)) {
652-
s.push_char(REPLACEMENT_CHAR);
653-
v = v.slice_from(1);
654-
} else {
655-
s.push_str(unsafe { ::cast::transmute(v.slice_to(w)) });
656-
v = v.slice_from(w);
657-
}
658-
}
659-
s
660-
}
661638
#[cfg(test)]
662639
mod tests {
663640
use prelude::*;

0 commit comments

Comments
 (0)