Skip to content

Commit b18c327

Browse files
committed
---
yaml --- r: 56955 b: refs/heads/try c: 35f3b63 h: refs/heads/master i: 56953: 2734f9a 56951: f82bc4f v: v3
1 parent df1ec3c commit b18c327

File tree

15 files changed

+341
-292
lines changed

15 files changed

+341
-292
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: c081ffbd1e845687202a975ea2e698b623e5722f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 79a2b2eafc3c766cecec8a5f76317693bae9ed17
5-
refs/heads/try: c98f0cb3627fbdc2f1e56cfe1aad20a96730d208
5+
refs/heads/try: 35f3b6324f1dc1f68539346d6bcda69a555910da
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libcore/vec.rs

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ use cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater};
1818
use clone::Clone;
1919
use iter::BaseIter;
2020
use iter;
21-
#[cfg(stage1)]
22-
#[cfg(stage2)]
23-
#[cfg(stage3)]
24-
use iterator::Iterator;
2521
use kinds::Copy;
2622
use libc;
2723
use option::{None, Option, Some};
@@ -1923,7 +1919,6 @@ impl<'self,T> ImmutableVector<T> for &'self [T] {
19231919
#[cfg(stage3)]
19241920
pub trait ImmutableVector<'self, T> {
19251921
fn slice(&self, start: uint, end: uint) -> &'self [T];
1926-
fn iter(self) -> VecIterator<'self, T>;
19271922
fn head(&self) -> &'self T;
19281923
fn head_opt(&self) -> Option<&'self T>;
19291924
fn tail(&self) -> &'self [T];
@@ -1954,15 +1949,6 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
19541949
slice(*self, start, end)
19551950
}
19561951

1957-
#[inline]
1958-
fn iter(self) -> VecIterator<'self, T> {
1959-
unsafe {
1960-
let p = vec::raw::to_ptr(self);
1961-
VecIterator{ptr: p, end: p.offset(self.len()),
1962-
lifetime: cast::transmute(p)}
1963-
}
1964-
}
1965-
19661952
/// Returns the first element of a vector, failing if the vector is empty.
19671953
#[inline]
19681954
fn head(&self) -> &'self T { head(*self) }
@@ -2809,33 +2795,7 @@ impl<A:Clone> Clone for ~[A] {
28092795
}
28102796
}
28112797

2812-
// could be implemented with &[T] with .slice(), but this avoids bounds checks
2813-
#[cfg(stage1)]
2814-
#[cfg(stage2)]
2815-
#[cfg(stage3)]
2816-
pub struct VecIterator<'self, T> {
2817-
priv ptr: *T,
2818-
priv end: *T,
2819-
priv lifetime: &'self T // FIXME: #5922
2820-
}
2821-
2822-
#[cfg(stage1)]
2823-
#[cfg(stage2)]
2824-
#[cfg(stage3)]
2825-
impl<'self, T> Iterator<&'self T> for VecIterator<'self, T> {
2826-
#[inline]
2827-
fn next(&mut self) -> Option<&'self T> {
2828-
unsafe {
2829-
if self.ptr == self.end {
2830-
None
2831-
} else {
2832-
let old = self.ptr;
2833-
self.ptr = self.ptr.offset(1);
2834-
Some(cast::transmute(old))
2835-
}
2836-
}
2837-
}
2838-
}
2798+
// ___________________________________________________________________________
28392799

28402800
#[cfg(test)]
28412801
mod tests {
@@ -4461,19 +4421,6 @@ mod tests {
44614421
[1, 2, 3, 4, 5, 5, 5, 5].cmp(& &[1, 2, 3, 4, 5, 6]) == Less;
44624422
[2, 2].cmp(& &[1, 2, 3, 4]) == Greater;
44634423
}
4464-
4465-
#[test]
4466-
fn test_iterator() {
4467-
use iterator::*;
4468-
let xs = [1, 2, 5, 10, 11];
4469-
let ys = [1, 2, 5, 10, 11, 19];
4470-
let mut it = xs.iter();
4471-
let mut i = 0;
4472-
for it.advance |&x| {
4473-
assert_eq!(x, ys[i]);
4474-
i += 1;
4475-
}
4476-
}
44774424
}
44784425

44794426
// Local Variables:

branches/try/src/librustpkg/path_util.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
// rustpkg utilities having to do with paths and directories
1212

1313
use core::path::*;
14-
use core::os;
14+
use core::{os, str};
15+
use core::option::*;
1516
use util::PkgId;
1617

1718
/// Returns the output directory to use.
@@ -50,6 +51,24 @@ pub fn default_dest_dir(pkg_dir: &Path) -> Path {
5051
}
5152
}
5253

54+
/// Replace all occurrences of '-' in the stem part of path with '_'
55+
/// This is because we treat rust-foo-bar-quux and rust_foo_bar_quux
56+
/// as the same name
57+
pub fn normalize(p: ~Path) -> ~Path {
58+
match p.filestem() {
59+
None => p,
60+
Some(st) => {
61+
let replaced = str::replace(st, "-", "_");
62+
if replaced != st {
63+
~p.with_filestem(replaced)
64+
}
65+
else {
66+
p
67+
}
68+
}
69+
}
70+
}
71+
5372
#[cfg(test)]
5473
mod test {
5574
use core::{os, rand};

0 commit comments

Comments
 (0)