Skip to content

Commit 9cbbb43

Browse files
committed
---
yaml --- r: 69406 b: refs/heads/auto c: 32622ce h: refs/heads/master v: v3
1 parent 013400c commit 9cbbb43

File tree

15 files changed

+107
-158
lines changed

15 files changed

+107
-158
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: 7ae17e0964b9f869881f4122cd0e1ccc19bee0d4
17+
refs/heads/auto: 32622cef992fea2ba23bafe39ed08730a2b78fb4
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]
706707
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: 4 additions & 3 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<DListIterator<'a, T>> {
359+
pub fn rev_iter<'a>(&'a self) -> InvertIterator<&'a T, DListIterator<'a, T>> {
360360
self.iter().invert()
361361
}
362362

@@ -376,7 +376,8 @@ 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<MutDListIterator<'a, T>> {
379+
pub fn mut_rev_iter<'a>(&'a mut self) -> InvertIterator<&'a mut T,
380+
MutDListIterator<'a, T>> {
380381
self.mut_iter().invert()
381382
}
382383

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

390391
/// Consume the list into an iterator yielding elements by value, in reverse
391392
#[inline]
392-
pub fn consume_rev_iter(self) -> InvertIterator<ConsumeIterator<T>> {
393+
pub fn consume_rev_iter(self) -> InvertIterator<T, ConsumeIterator<T>> {
393394
self.consume_iter().invert()
394395
}
395396
}

branches/auto/src/libextra/priority_queue.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ 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 }
3330
}
3431

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

branches/auto/src/libextra/ringbuf.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ 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 }
4037
}
4138

4239
impl<T> Mutable for RingBuf<T> {
@@ -184,7 +181,7 @@ impl<T> RingBuf<T> {
184181
}
185182

186183
/// Back-to-front iterator.
187-
pub fn rev_iter<'a>(&'a self) -> InvertIterator<RingBufIterator<'a, T>> {
184+
pub fn rev_iter<'a>(&'a self) -> InvertIterator<&'a T, RingBufIterator<'a, T>> {
188185
self.iter().invert()
189186
}
190187

@@ -195,7 +192,7 @@ impl<T> RingBuf<T> {
195192
}
196193

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

branches/auto/src/libextra/smallintmap.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ 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 }
4340
}
4441

4542
impl<V> Mutable for SmallIntMap<V> {
@@ -207,7 +204,7 @@ impl<V> SmallIntMap<V> {
207204
/// Empties the hash map, moving all values into the specified closure
208205
pub fn consume(&mut self)
209206
-> FilterMapIterator<(uint, Option<V>), (uint, V),
210-
EnumerateIterator<VecConsumeIterator<Option<V>>>>
207+
EnumerateIterator<Option<V>, VecConsumeIterator<Option<V>>>>
211208
{
212209
let values = replace(&mut self.v, ~[]);
213210
values.consume_iter().enumerate().filter_map(|(i, v)| {
@@ -293,7 +290,8 @@ pub struct SmallIntMapIterator<'self, T> {
293290

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

298296
pub struct SmallIntMapMutIterator<'self, T> {
299297
priv front: uint,
@@ -303,7 +301,8 @@ pub struct SmallIntMapMutIterator<'self, T> {
303301

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

308307
#[cfg(test)]
309308
mod test_map {

branches/auto/src/libextra/treemap.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -135,19 +135,6 @@ 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-
151138
/// Insert a key-value pair from the map. If the key already had a value
152139
/// present in the map, that value is returned. Otherwise None is returned.
153140
fn swap(&mut self, key: K, value: V) -> Option<V> {

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,16 @@ 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));
216214
assert_eq!(abi::slice_elt_base, 0);
217215
assert_eq!(abi::slice_elt_len, 1);
218-
llconst = C_struct([llptr, size]);
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+
}
219224
}
220225
_ => {
221226
cx.sess.span_bug(e.span,

branches/auto/src/libstd/container.rs

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

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

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

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

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

branches/auto/src/libstd/hashmap.rs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,6 @@ 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 }
288285
}
289286

290287
impl<K:Hash + Eq,V> Mutable for HashMap<K, V> {
@@ -325,19 +322,6 @@ impl<K:Hash + Eq,V> MutableMap<K, V> for HashMap<K, V> {
325322
Some(self.mut_value_for_bucket(idx))
326323
}
327324

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-
341325
/// Insert a key-value pair from the map. If the key already had a value
342326
/// present in the map, that value is returned. Otherwise None is returned.
343327
fn swap(&mut self, k: K, v: V) -> Option<V> {
@@ -661,9 +645,6 @@ impl<T:Hash + Eq> Eq for HashSet<T> {
661645
impl<T:Hash + Eq> Container for HashSet<T> {
662646
/// Return the number of elements in the set
663647
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() }
667648
}
668649

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

771752
/// Visit the values representing the symmetric difference
772753
pub fn symmetric_difference_iter<'a>(&'a self, other: &'a HashSet<T>)
773-
-> ChainIterator<SetAlgebraIter<'a, T>, SetAlgebraIter<'a, T>> {
754+
-> ChainIterator<&'a T, SetAlgebraIter<'a, T>, SetAlgebraIter<'a, T>> {
774755
self.difference_iter(other).chain_(other.difference_iter(self))
775756
}
776757

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

784765
/// Visit the values representing the union
785766
pub fn union_iter<'a>(&'a self, other: &'a HashSet<T>)
786-
-> ChainIterator<HashSetIterator<'a, T>, SetAlgebraIter<'a, T>> {
767+
-> ChainIterator<&'a T, HashSetIterator<'a, T>, SetAlgebraIter<'a, T>> {
787768
self.iter().chain_(other.difference_iter(self))
788769
}
789770

0 commit comments

Comments
 (0)