Skip to content

Commit 80bab72

Browse files
committed
---
yaml --- r: 69407 b: refs/heads/auto c: ffe549d h: refs/heads/master i: 69405: 013400c 69403: 68eb9f1 69399: 7c71aa3 69391: 9b609af 69375: bfa0206 v: v3
1 parent 9cbbb43 commit 80bab72

File tree

15 files changed

+168
-119
lines changed

15 files changed

+168
-119
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ 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: 32622cef992fea2ba23bafe39ed08730a2b78fb4
17+
refs/heads/auto: ffe549daf5b718226490b9e0b677d9876c807f4e
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/src/libextra/bitv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,8 +703,8 @@ impl cmp::Eq for BitvSet {
703703
}
704704

705705
impl Container for BitvSet {
706-
#[inline]
707706
fn len(&self) -> uint { self.size }
707+
fn is_empty(&self) -> bool { self.size == 0 }
708708
}
709709

710710
impl Mutable for BitvSet {

branches/auto/src/libextra/dlist.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ impl<T> DList<T> {
356356

357357
/// Provide a reverse iterator
358358
#[inline]
359-
pub fn rev_iter<'a>(&'a self) -> InvertIterator<&'a T, DListIterator<'a, T>> {
359+
pub fn rev_iter<'a>(&'a self) -> InvertIterator<DListIterator<'a, T>> {
360360
self.iter().invert()
361361
}
362362

@@ -376,8 +376,7 @@ impl<T> DList<T> {
376376
}
377377
/// Provide a reverse iterator with mutable references
378378
#[inline]
379-
pub fn mut_rev_iter<'a>(&'a mut self) -> InvertIterator<&'a mut T,
380-
MutDListIterator<'a, T>> {
379+
pub fn mut_rev_iter<'a>(&'a mut self) -> InvertIterator<MutDListIterator<'a, T>> {
381380
self.mut_iter().invert()
382381
}
383382

@@ -390,7 +389,7 @@ impl<T> DList<T> {
390389

391390
/// Consume the list into an iterator yielding elements by value, in reverse
392391
#[inline]
393-
pub fn consume_rev_iter(self) -> InvertIterator<T, ConsumeIterator<T>> {
392+
pub fn consume_rev_iter(self) -> InvertIterator<ConsumeIterator<T>> {
394393
self.consume_iter().invert()
395394
}
396395
}

branches/auto/src/libextra/priority_queue.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ pub struct PriorityQueue<T> {
2727
impl<T:Ord> Container for PriorityQueue<T> {
2828
/// Returns the length of the queue
2929
fn len(&self) -> uint { self.data.len() }
30+
31+
/// Returns true if a queue contains no elements
32+
fn is_empty(&self) -> bool { self.len() == 0 }
3033
}
3134

3235
impl<T:Ord> Mutable for PriorityQueue<T> {

branches/auto/src/libextra/ringbuf.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ pub struct RingBuf<T> {
3434
impl<T> Container for RingBuf<T> {
3535
/// Return the number of elements in the RingBuf
3636
fn len(&self) -> uint { self.nelts }
37+
38+
/// Return true if the RingBufcontains no elements
39+
fn is_empty(&self) -> bool { self.len() == 0 }
3740
}
3841

3942
impl<T> Mutable for RingBuf<T> {
@@ -181,7 +184,7 @@ impl<T> RingBuf<T> {
181184
}
182185

183186
/// Back-to-front iterator.
184-
pub fn rev_iter<'a>(&'a self) -> InvertIterator<&'a T, RingBufIterator<'a, T>> {
187+
pub fn rev_iter<'a>(&'a self) -> InvertIterator<RingBufIterator<'a, T>> {
185188
self.iter().invert()
186189
}
187190

@@ -192,7 +195,7 @@ impl<T> RingBuf<T> {
192195
}
193196

194197
/// Back-to-front iterator which returns mutable values.
195-
pub fn mut_rev_iter<'a>(&'a mut self) -> InvertIterator<&'a mut T, RingBufMutIterator<'a, T>> {
198+
pub fn mut_rev_iter<'a>(&'a mut self) -> InvertIterator<RingBufMutIterator<'a, T>> {
196199
self.mut_iter().invert()
197200
}
198201
}

branches/auto/src/libextra/smallintmap.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ impl<V> Container for SmallIntMap<V> {
3737
}
3838
sz
3939
}
40+
41+
/// Return true if the map contains no elements
42+
fn is_empty(&self) -> bool { self.len() == 0 }
4043
}
4144

4245
impl<V> Mutable for SmallIntMap<V> {
@@ -204,7 +207,7 @@ impl<V> SmallIntMap<V> {
204207
/// Empties the hash map, moving all values into the specified closure
205208
pub fn consume(&mut self)
206209
-> FilterMapIterator<(uint, Option<V>), (uint, V),
207-
EnumerateIterator<Option<V>, VecConsumeIterator<Option<V>>>>
210+
EnumerateIterator<VecConsumeIterator<Option<V>>>>
208211
{
209212
let values = replace(&mut self.v, ~[]);
210213
values.consume_iter().enumerate().filter_map(|(i, v)| {
@@ -290,8 +293,7 @@ pub struct SmallIntMapIterator<'self, T> {
290293

291294
iterator!(impl SmallIntMapIterator -> (uint, &'self T), get_ref)
292295
double_ended_iterator!(impl SmallIntMapIterator -> (uint, &'self T), get_ref)
293-
pub type SmallIntMapRevIterator<'self, T> = InvertIterator<(uint, &'self T),
294-
SmallIntMapIterator<'self, T>>;
296+
pub type SmallIntMapRevIterator<'self, T> = InvertIterator<SmallIntMapIterator<'self, T>>;
295297

296298
pub struct SmallIntMapMutIterator<'self, T> {
297299
priv front: uint,
@@ -301,8 +303,7 @@ pub struct SmallIntMapMutIterator<'self, T> {
301303

302304
iterator!(impl SmallIntMapMutIterator -> (uint, &'self mut T), get_mut_ref)
303305
double_ended_iterator!(impl SmallIntMapMutIterator -> (uint, &'self mut T), get_mut_ref)
304-
pub type SmallIntMapMutRevIterator<'self, T> = InvertIterator<(uint, &'self mut T),
305-
SmallIntMapMutIterator<'self, T>>;
306+
pub type SmallIntMapMutRevIterator<'self, T> = InvertIterator<SmallIntMapMutIterator<'self, T>>;
306307

307308
#[cfg(test)]
308309
mod test_map {

branches/auto/src/libextra/treemap.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,19 @@ impl<K: TotalOrd, V> MutableMap<K, V> for TreeMap<K, V> {
135135
find_mut(&mut self.root, key)
136136
}
137137

138+
/// Insert a key-value pair into the map. An existing value for a
139+
/// key is replaced by the new value. Return true if the key did
140+
/// not already exist in the map.
141+
fn insert(&mut self, key: K, value: V) -> bool {
142+
self.swap(key, value).is_none()
143+
}
144+
145+
/// Remove a key-value pair from the map. Return true if the key
146+
/// was present in the map, otherwise false.
147+
fn remove(&mut self, key: &K) -> bool {
148+
self.pop(key).is_some()
149+
}
150+
138151
/// Insert a key-value pair from the map. If the key already had a value
139152
/// present in the map, that value is returned. Otherwise None is returned.
140153
fn swap(&mut self, key: K, value: V) -> Option<V> {

branches/auto/src/librustc/middle/trans/consts.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,16 +211,11 @@ pub fn const_expr(cx: @mut CrateContext, e: @ast::expr) -> ValueRef {
211211
}
212212
ty::AutoBorrowVec(ty::re_static, m) => {
213213
assert!(m != ast::m_mutbl);
214+
let size = machine::llsize_of(cx,
215+
val_ty(llconst));
214216
assert_eq!(abi::slice_elt_base, 0);
215217
assert_eq!(abi::slice_elt_len, 1);
216-
217-
match ty::get(ty).sty {
218-
ty::ty_evec(_, ty::vstore_fixed(*)) => {
219-
let size = machine::llsize_of(cx, val_ty(llconst));
220-
llconst = C_struct([llptr, size]);
221-
}
222-
_ => {}
223-
}
218+
llconst = C_struct([llptr, size]);
224219
}
225220
_ => {
226221
cx.sess.span_bug(e.span,

branches/auto/src/libstd/container.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ pub trait Container {
1919
fn len(&self) -> uint;
2020

2121
/// Return true if the container contains no elements
22-
#[inline]
23-
fn is_empty(&self) -> bool {
24-
self.len() == 0
25-
}
22+
fn is_empty(&self) -> bool;
2623
}
2724

2825
/// A trait to represent mutable containers
@@ -46,17 +43,11 @@ pub trait MutableMap<K, V>: Map<K, V> + Mutable {
4643
/// Insert a key-value pair into the map. An existing value for a
4744
/// key is replaced by the new value. Return true if the key did
4845
/// not already exist in the map.
49-
#[inline]
50-
fn insert(&mut self, key: K, value: V) -> bool {
51-
self.swap(key, value).is_none()
52-
}
46+
fn insert(&mut self, key: K, value: V) -> bool;
5347

5448
/// Remove a key-value pair from the map. Return true if the key
5549
/// was present in the map, otherwise false.
56-
#[inline]
57-
fn remove(&mut self, key: &K) -> bool {
58-
self.pop(key).is_some()
59-
}
50+
fn remove(&mut self, key: &K) -> bool;
6051

6152
/// Insert a key-value pair from the map. If the key already had a value
6253
/// present in the map, that value is returned. Otherwise None is returned.

branches/auto/src/libstd/hashmap.rs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ impl<K:Hash + Eq,V> HashMap<K, V> {
282282
impl<K:Hash + Eq,V> Container for HashMap<K, V> {
283283
/// Return the number of elements in the map
284284
fn len(&self) -> uint { self.size }
285+
286+
/// Return true if the map contains no elements
287+
fn is_empty(&self) -> bool { self.len() == 0 }
285288
}
286289

287290
impl<K:Hash + Eq,V> Mutable for HashMap<K, V> {
@@ -322,6 +325,19 @@ impl<K:Hash + Eq,V> MutableMap<K, V> for HashMap<K, V> {
322325
Some(self.mut_value_for_bucket(idx))
323326
}
324327

328+
/// Insert a key-value pair into the map. An existing value for a
329+
/// key is replaced by the new value. Return true if the key did
330+
/// not already exist in the map.
331+
fn insert(&mut self, k: K, v: V) -> bool {
332+
self.swap(k, v).is_none()
333+
}
334+
335+
/// Remove a key-value pair from the map. Return true if the key
336+
/// was present in the map, otherwise false.
337+
fn remove(&mut self, k: &K) -> bool {
338+
self.pop(k).is_some()
339+
}
340+
325341
/// Insert a key-value pair from the map. If the key already had a value
326342
/// present in the map, that value is returned. Otherwise None is returned.
327343
fn swap(&mut self, k: K, v: V) -> Option<V> {
@@ -645,6 +661,9 @@ impl<T:Hash + Eq> Eq for HashSet<T> {
645661
impl<T:Hash + Eq> Container for HashSet<T> {
646662
/// Return the number of elements in the set
647663
fn len(&self) -> uint { self.map.len() }
664+
665+
/// Return true if the set contains no elements
666+
fn is_empty(&self) -> bool { self.map.is_empty() }
648667
}
649668

650669
impl<T:Hash + Eq> Mutable for HashSet<T> {
@@ -751,7 +770,7 @@ impl<T:Hash + Eq> HashSet<T> {
751770

752771
/// Visit the values representing the symmetric difference
753772
pub fn symmetric_difference_iter<'a>(&'a self, other: &'a HashSet<T>)
754-
-> ChainIterator<&'a T, SetAlgebraIter<'a, T>, SetAlgebraIter<'a, T>> {
773+
-> ChainIterator<SetAlgebraIter<'a, T>, SetAlgebraIter<'a, T>> {
755774
self.difference_iter(other).chain_(other.difference_iter(self))
756775
}
757776

@@ -764,7 +783,7 @@ impl<T:Hash + Eq> HashSet<T> {
764783

765784
/// Visit the values representing the union
766785
pub fn union_iter<'a>(&'a self, other: &'a HashSet<T>)
767-
-> ChainIterator<&'a T, HashSetIterator<'a, T>, SetAlgebraIter<'a, T>> {
786+
-> ChainIterator<HashSetIterator<'a, T>, SetAlgebraIter<'a, T>> {
768787
self.iter().chain_(other.difference_iter(self))
769788
}
770789

0 commit comments

Comments
 (0)