Skip to content

Commit 1706265

Browse files
committed
---
yaml --- r: 49961 b: refs/heads/auto c: 5a77a10 h: refs/heads/master i: 49959: 312a02e v: v3
1 parent 3420254 commit 1706265

File tree

5 files changed

+34
-20
lines changed

5 files changed

+34
-20
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 0942c802725b4c2816f2232304cdd14b3e44cd3f
17+
refs/heads/auto: 5a77a1048897a12c9031d3e0b3867f0c6e3673ea
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167

branches/auto/src/libcore/rt/thread_local_storage.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ type pthread_key_t = c_ulong;
4040

4141
#[cfg(target_os="linux")]
4242
#[cfg(target_os="freebsd")]
43+
#[cfg(target_os="android")]
4344
#[allow(non_camel_case_types)] // foreign type
4445
type pthread_key_t = c_uint;
4546

branches/auto/src/libcore/trie.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ impl<T> Map<uint, T> for TrieMap<T> {
137137
}
138138

139139
impl<T> TrieMap<T> {
140-
/// Create an empty TrieMap
141140
#[inline(always)]
142141
static pure fn new() -> TrieMap<T> {
143142
TrieMap{root: TrieNode::new(), length: 0}
@@ -192,12 +191,6 @@ impl Mutable for TrieSet {
192191
}
193192

194193
impl TrieSet {
195-
/// Create an empty TrieSet
196-
#[inline(always)]
197-
static pure fn new() -> TrieSet {
198-
TrieSet{map: TrieMap::new()}
199-
}
200-
201194
/// Return true if the set contains a value
202195
#[inline(always)]
203196
pure fn contains(&self, value: &uint) -> bool {
@@ -272,8 +265,8 @@ impl<T> TrieNode<T> {
272265
// if this was done via a trait, the key could be generic
273266
#[inline(always)]
274267
pure fn chunk(n: uint, idx: uint) -> uint {
275-
let sh = uint::bits - (SHIFT * (idx + 1));
276-
(n >> sh) & MASK
268+
let real_idx = uint::bytes - 1 - idx;
269+
(n >> (SHIFT * real_idx)) & MASK
277270
}
278271

279272
fn insert<T>(count: &mut uint, child: &mut Child<T>, key: uint, value: T,

branches/auto/src/libstd/deque.rs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,40 +22,61 @@ pub struct Deque<T> {
2222
}
2323

2424
impl<T> Container for Deque<T> {
25+
/// Return the number of elements in the deque
2526
pure fn len(&self) -> uint { self.nelts }
27+
28+
/// Return true if the deque contains no elements
2629
pure fn is_empty(&self) -> bool { self.len() == 0 }
2730
}
2831

2932
impl<T> Mutable for Deque<T> {
33+
/// Clear the deque, removing all values.
3034
fn clear(&mut self) {
31-
for vec::each_mut(self.elts) |x| { *x = None }
35+
for self.elts.each_mut |x| { *x = None }
3236
self.nelts = 0;
3337
self.lo = 0;
3438
self.hi = 0;
3539
}
3640
}
3741

3842
pub impl<T> Deque<T> {
43+
/// Create an empty Deque
3944
static pure fn new() -> Deque<T> {
4045
Deque{nelts: 0, lo: 0, hi: 0,
4146
elts: vec::from_fn(initial_capacity, |_| None)}
4247
}
4348

49+
/// Return a reference to the first element in the deque
50+
///
51+
/// Fails if the deque is empty
4452
fn peek_front(&self) -> &self/T { get(self.elts, self.lo) }
53+
54+
/// Return a reference to the last element in the deque
55+
///
56+
/// Fails if the deque is empty
4557
fn peek_back(&self) -> &self/T { get(self.elts, self.hi - 1u) }
4658

59+
/// Retrieve an element in the deque by index
60+
///
61+
/// Fails if there is no element with the given index
4762
fn get(&self, i: int) -> &self/T {
4863
let idx = (self.lo + (i as uint)) % self.elts.len();
4964
get(self.elts, idx)
5065
}
5166

67+
/// Remove and return the first element in the deque
68+
///
69+
/// Fails if the deque is empty
5270
fn pop_front(&mut self) -> T {
5371
let mut result = self.elts[self.lo].swap_unwrap();
5472
self.lo = (self.lo + 1u) % self.elts.len();
5573
self.nelts -= 1u;
5674
result
5775
}
5876

77+
/// Remove and return the last element in the deque
78+
///
79+
/// Fails if the deque is empty
5980
fn pop_back(&mut self) -> T {
6081
if self.hi == 0u {
6182
self.hi = self.elts.len() - 1u;
@@ -66,6 +87,7 @@ pub impl<T> Deque<T> {
6687
result
6788
}
6889

90+
/// Prepend an element to the deque
6991
fn add_front(&mut self, t: T) {
7092
let oldlo = self.lo;
7193
if self.lo == 0u {
@@ -80,6 +102,7 @@ pub impl<T> Deque<T> {
80102
self.nelts += 1u;
81103
}
82104

105+
/// Append an element to the deque
83106
fn add_back(&mut self, t: T) {
84107
if self.lo == self.hi && self.nelts != 0u {
85108
self.elts = grow(self.nelts, self.lo, self.elts);

branches/auto/src/libstd/treemap.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -636,14 +636,13 @@ fn remove<K: TotalOrd, V>(node: &mut Option<~TreeNode<K, V>>,
636636
fn heir_swap<K: TotalOrd, V>(node: &mut ~TreeNode<K, V>,
637637
child: &mut Option<~TreeNode<K, V>>) {
638638
// *could* be done without recursion, but it won't borrow check
639-
do child.mutate |mut child| {
640-
if child.right.is_some() {
641-
heir_swap(node, &mut child.right);
639+
for child.each_mut |x| {
640+
if x.right.is_some() {
641+
heir_swap(node, &mut x.right);
642642
} else {
643-
node.key <-> child.key;
644-
node.value <-> child.value;
643+
node.key <-> x.key;
644+
node.value <-> x.value;
645645
}
646-
child
647646
}
648647
}
649648

@@ -689,7 +688,7 @@ fn remove<K: TotalOrd, V>(node: &mut Option<~TreeNode<K, V>>,
689688
save.level -= 1;
690689

691690
if right_level > save.level {
692-
do save.right.mutate |mut x| { x.level = save.level; x }
691+
for save.right.each_mut |x| { x.level = save.level }
693692
}
694693

695694
skew(save);
@@ -988,8 +987,6 @@ mod test_treemap {
988987
let m = m;
989988
let mut a = m.iter();
990989

991-
// FIXME: #4492 (ICE): iter.get() == Some((&x1, &y1))
992-
993990
fail_unless!(map_next(&mut a).unwrap() == (&x1, &y1));
994991
fail_unless!(map_next(&mut a).unwrap() == (&x2, &y2));
995992
fail_unless!(map_next(&mut a).unwrap() == (&x3, &y3));

0 commit comments

Comments
 (0)