Skip to content

Commit 2901d5f

Browse files
committed
---
yaml --- r: 66174 b: refs/heads/master c: 8cadca4 h: refs/heads/master v: v3
1 parent d7af184 commit 2901d5f

File tree

7 files changed

+39
-149
lines changed

7 files changed

+39
-149
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: cb58b19f023f95614e4a2bc3c812614d0938a9f2
2+
refs/heads/master: 8cadca4e41f2aad72391b834f295ae01f9c29551
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/src/libextra/time.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,9 +1142,6 @@ mod tests {
11421142
assert!(result::unwrap(strptime("-0800", "%z")).tm_gmtoff ==
11431143
0);
11441144
assert!(test("%", "%%"));
1145-
1146-
// Test for #7256
1147-
assert_eq!(strptime("360", "%Y-%m-%d"), Err(~"Invalid year"))
11481145
}
11491146
11501147
fn test_ctime() {

trunk/src/librustc/back/abi.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,3 @@ pub static slice_elt_len: uint = 1u;
7474
pub static worst_case_glue_call_args: uint = 7u;
7575

7676
pub static abi_version: uint = 1u;
77-
78-
pub fn memcpy_glue_name() -> ~str { return ~"rust_memcpy_glue"; }
79-
80-
pub fn bzero_glue_name() -> ~str { return ~"rust_bzero_glue"; }
81-
82-
pub fn yield_glue_name() -> ~str { return ~"rust_yield_glue"; }
83-
84-
pub fn no_op_type_glue_name() -> ~str { return ~"rust_no_op_type_glue"; }

trunk/src/librustc/middle/resolve.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,26 +1415,24 @@ impl Resolver {
14151415
(ReducedGraphParent,
14161416
vt<ReducedGraphParent>)) {
14171417
let ident = variant.node.name;
1418-
1419-
let privacy =
1420-
match variant.node.vis {
1421-
public => Public,
1422-
private => Private,
1423-
inherited => parent_privacy
1424-
};
1418+
let (child, _) = self.add_child(ident, parent, ForbidDuplicateValues,
1419+
variant.span);
1420+
1421+
let privacy;
1422+
match variant.node.vis {
1423+
public => privacy = Public,
1424+
private => privacy = Private,
1425+
inherited => privacy = parent_privacy
1426+
}
14251427

14261428
match variant.node.kind {
14271429
tuple_variant_kind(_) => {
1428-
let (child, _) = self.add_child(ident, parent, ForbidDuplicateValues,
1429-
variant.span);
14301430
child.define_value(privacy,
14311431
def_variant(item_id,
14321432
local_def(variant.node.id)),
14331433
variant.span);
14341434
}
14351435
struct_variant_kind(_) => {
1436-
let (child, _) = self.add_child(ident, parent, ForbidDuplicateTypesAndValues,
1437-
variant.span);
14381436
child.define_type(privacy,
14391437
def_variant(item_id,
14401438
local_def(variant.node.id)),

trunk/src/libstd/hashmap.rs

Lines changed: 27 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@
1818
use container::{Container, Mutable, Map, Set};
1919
use cmp::{Eq, Equiv};
2020
use hash::Hash;
21-
use iterator::{Iterator, IteratorUtil};
21+
use old_iter::BaseIter;
22+
use old_iter;
23+
use iterator::IteratorUtil;
2224
use option::{None, Option, Some};
2325
use rand::RngUtil;
2426
use rand;
2527
use uint;
2628
use vec;
27-
use vec::{ImmutableVector, MutableVector};
29+
use vec::ImmutableVector;
2830
use kinds::Copy;
2931
use util::{replace, unreachable};
3032

@@ -309,17 +311,24 @@ impl<K:Hash + Eq,V> Map<K, V> for HashMap<K, V> {
309311

310312
/// Visit all key-value pairs
311313
fn each<'a>(&'a self, blk: &fn(&K, &'a V) -> bool) -> bool {
312-
self.iter().advance(|(k, v)| blk(k, v))
314+
for self.buckets.iter().advance |bucket| {
315+
for bucket.iter().advance |pair| {
316+
if !blk(&pair.key, &pair.value) {
317+
return false;
318+
}
319+
}
320+
}
321+
return true;
313322
}
314323

315324
/// Visit all keys
316325
fn each_key(&self, blk: &fn(k: &K) -> bool) -> bool {
317-
self.iter().advance(|(k, _)| blk(k))
326+
self.each(|k, _| blk(k))
318327
}
319328

320329
/// Visit all values
321330
fn each_value<'a>(&'a self, blk: &fn(v: &'a V) -> bool) -> bool {
322-
self.iter().advance(|(_, v)| blk(v))
331+
self.each(|_, v| blk(v))
323332
}
324333

325334
/// Iterate over the map and mutate the contained values
@@ -515,19 +524,6 @@ impl<K: Hash + Eq, V> HashMap<K, V> {
515524
TableFull | FoundHole(_) => None,
516525
}
517526
}
518-
519-
/// An iterator visiting all key-value pairs in arbitrary order.
520-
/// Iterator element type is (&'a K, &'a V).
521-
pub fn iter<'a>(&'a self) -> HashMapIterator<'a, K, V> {
522-
HashMapIterator { iter: self.buckets.iter() }
523-
}
524-
525-
/// An iterator visiting all key-value pairs in arbitrary order,
526-
/// with mutable references to the values.
527-
/// Iterator element type is (&'a K, &'a mut V).
528-
pub fn mut_iter<'a>(&'a mut self) -> HashMapMutIterator<'a, K, V> {
529-
HashMapMutIterator { iter: self.buckets.mut_iter() }
530-
}
531527
}
532528

533529
impl<K: Hash + Eq, V: Copy> HashMap<K, V> {
@@ -546,7 +542,7 @@ impl<K:Hash + Eq,V:Eq> Eq for HashMap<K, V> {
546542
fn eq(&self, other: &HashMap<K, V>) -> bool {
547543
if self.len() != other.len() { return false; }
548544

549-
for self.iter().advance |(key, value)| {
545+
for self.each |key, value| {
550546
match other.find(key) {
551547
None => return false,
552548
Some(v) => if value != v { return false },
@@ -559,68 +555,19 @@ impl<K:Hash + Eq,V:Eq> Eq for HashMap<K, V> {
559555
fn ne(&self, other: &HashMap<K, V>) -> bool { !self.eq(other) }
560556
}
561557

562-
/// HashMap iterator
563-
pub struct HashMapIterator<'self, K, V> {
564-
priv iter: vec::VecIterator<'self, Option<Bucket<K, V>>>,
565-
}
566-
567-
/// HashMap mutable values iterator
568-
pub struct HashMapMutIterator<'self, K, V> {
569-
priv iter: vec::VecMutIterator<'self, Option<Bucket<K, V>>>,
570-
}
571-
572-
/// HashSet iterator
573-
pub struct HashSetIterator<'self, K> {
574-
priv iter: vec::VecIterator<'self, Option<Bucket<K, ()>>>,
575-
}
576-
577-
impl<'self, K, V> Iterator<(&'self K, &'self V)> for HashMapIterator<'self, K, V> {
578-
#[inline]
579-
fn next(&mut self) -> Option<(&'self K, &'self V)> {
580-
for self.iter.advance |elt| {
581-
match elt {
582-
&Some(ref bucket) => return Some((&bucket.key, &bucket.value)),
583-
&None => {},
584-
}
585-
}
586-
None
587-
}
588-
}
589-
590-
impl<'self, K, V> Iterator<(&'self K, &'self mut V)> for HashMapMutIterator<'self, K, V> {
591-
#[inline]
592-
fn next(&mut self) -> Option<(&'self K, &'self mut V)> {
593-
for self.iter.advance |elt| {
594-
match elt {
595-
&Some(ref mut bucket) => return Some((&bucket.key, &mut bucket.value)),
596-
&None => {},
597-
}
598-
}
599-
None
600-
}
601-
}
602-
603-
impl<'self, K> Iterator<&'self K> for HashSetIterator<'self, K> {
604-
#[inline]
605-
fn next(&mut self) -> Option<&'self K> {
606-
for self.iter.advance |elt| {
607-
match elt {
608-
&Some(ref bucket) => return Some(&bucket.key),
609-
&None => {},
610-
}
611-
}
612-
None
613-
}
614-
}
615-
616-
617558
/// An implementation of a hash set using the underlying representation of a
618559
/// HashMap where the value is (). As with the `HashMap` type, a `HashSet`
619560
/// requires that the elements implement the `Eq` and `Hash` traits.
620561
pub struct HashSet<T> {
621562
priv map: HashMap<T, ()>
622563
}
623564

565+
impl<T:Hash + Eq> BaseIter<T> for HashSet<T> {
566+
/// Visit all values in order
567+
fn each(&self, f: &fn(&T) -> bool) -> bool { self.map.each_key(f) }
568+
fn size_hint(&self) -> Option<uint> { Some(self.len()) }
569+
}
570+
624571
impl<T:Hash + Eq> Eq for HashSet<T> {
625572
fn eq(&self, other: &HashSet<T>) -> bool { self.map == other.map }
626573
fn ne(&self, other: &HashSet<T>) -> bool { self.map != other.map }
@@ -654,12 +601,12 @@ impl<T:Hash + Eq> Set<T> for HashSet<T> {
654601
/// Return true if the set has no elements in common with `other`.
655602
/// This is equivalent to checking for an empty intersection.
656603
fn is_disjoint(&self, other: &HashSet<T>) -> bool {
657-
self.iter().all(|v| !other.contains(v))
604+
old_iter::all(self, |v| !other.contains(v))
658605
}
659606

660607
/// Return true if the set is a subset of another
661608
fn is_subset(&self, other: &HashSet<T>) -> bool {
662-
self.iter().all(|v| other.contains(v))
609+
old_iter::all(self, |v| other.contains(v))
663610
}
664611

665612
/// Return true if the set is a superset of another
@@ -669,7 +616,7 @@ impl<T:Hash + Eq> Set<T> for HashSet<T> {
669616

670617
/// Visit the values representing the difference
671618
fn difference(&self, other: &HashSet<T>, f: &fn(&T) -> bool) -> bool {
672-
self.iter().advance(|v| other.contains(v) || f(v))
619+
self.each(|v| other.contains(v) || f(v))
673620
}
674621

675622
/// Visit the values representing the symmetric difference
@@ -681,12 +628,12 @@ impl<T:Hash + Eq> Set<T> for HashSet<T> {
681628

682629
/// Visit the values representing the intersection
683630
fn intersection(&self, other: &HashSet<T>, f: &fn(&T) -> bool) -> bool {
684-
self.iter().advance(|v| !other.contains(v) || f(v))
631+
self.each(|v| !other.contains(v) || f(v))
685632
}
686633

687634
/// Visit the values representing the union
688635
fn union(&self, other: &HashSet<T>, f: &fn(&T) -> bool) -> bool {
689-
self.iter().advance(f) && other.iter().advance(|v| self.contains(v) || f(v))
636+
self.each(f) && other.each(|v| self.contains(v) || f(v))
690637
}
691638
}
692639

@@ -717,18 +664,6 @@ impl<T:Hash + Eq> HashSet<T> {
717664
pub fn contains_equiv<Q:Hash + Equiv<T>>(&self, value: &Q) -> bool {
718665
self.map.contains_key_equiv(value)
719666
}
720-
721-
/// Visit all elements in arbitrary order
722-
/// FIXME: #6978: Remove when all callers are converted
723-
pub fn each(&self, f: &fn(&T) -> bool) -> bool {
724-
self.iter().advance(f)
725-
}
726-
727-
/// An iterator visiting all elements in arbitrary order.
728-
/// Iterator element type is &'a T.
729-
pub fn iter<'a>(&'a self) -> HashSetIterator<'a, T> {
730-
HashSetIterator { iter: self.map.buckets.iter() }
731-
}
732667
}
733668

734669
#[cfg(test)]
@@ -873,7 +808,7 @@ mod test_map {
873808
assert!(m.insert(i, i*2));
874809
}
875810
let mut observed = 0;
876-
for m.iter().advance |(k, v)| {
811+
for m.each |k, v| {
877812
assert_eq!(*v, *k * 2);
878813
observed |= (1 << *k);
879814
}
@@ -950,7 +885,6 @@ mod test_set {
950885
use super::*;
951886
use container::{Container, Map, Set};
952887
use vec;
953-
use uint;
954888

955889
#[test]
956890
fn test_disjoint() {
@@ -1003,19 +937,6 @@ mod test_set {
1003937
assert!(b.is_superset(&a));
1004938
}
1005939

1006-
#[test]
1007-
fn test_iterate() {
1008-
let mut a = HashSet::new();
1009-
for uint::range(0, 32) |i| {
1010-
assert!(a.insert(i));
1011-
}
1012-
let mut observed = 0;
1013-
for a.iter().advance |k| {
1014-
observed |= (1 << *k);
1015-
}
1016-
assert_eq!(observed, 0xFFFF_FFFF);
1017-
}
1018-
1019940
#[test]
1020941
fn test_intersection() {
1021942
let mut a = HashSet::new();

trunk/src/libstd/to_str.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use hash::Hash;
2323
use cmp::Eq;
2424
use old_iter::BaseIter;
2525
use vec::ImmutableVector;
26-
use iterator::IteratorUtil;
2726

2827
/// A generic trait for converting a value to a string
2928
pub trait ToStr {
@@ -57,7 +56,7 @@ impl<A:ToStr+Hash+Eq, B:ToStr+Hash+Eq> ToStr for HashMap<A, B> {
5756
#[inline]
5857
fn to_str(&self) -> ~str {
5958
let mut (acc, first) = (~"{", true);
60-
for self.iter().advance |(key, value)| {
59+
for self.each |key, value| {
6160
if first {
6261
first = false;
6362
}
@@ -77,7 +76,7 @@ impl<A:ToStr+Hash+Eq> ToStr for HashSet<A> {
7776
#[inline]
7877
fn to_str(&self) -> ~str {
7978
let mut (acc, first) = (~"{", true);
80-
for self.iter().advance |element| {
79+
for self.each |element| {
8180
if first {
8281
first = false;
8382
}

trunk/src/test/compile-fail/dup-struct-enum-struct-variant.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)