Skip to content

Commit ca42078

Browse files
committed
---
yaml --- r: 143907 b: refs/heads/try2 c: d9492d7 h: refs/heads/master i: 143905: 8f8c52f 143903: f557c9e v: v3
1 parent eb20e4f commit ca42078

File tree

95 files changed

+2614
-869
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+2614
-869
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 88b89f84766930b1d6d7be1c558290c40e55d4ff
8+
refs/heads/try2: d9492d72baa73082be91edf8acd6bb97747db3c9
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/rustpkg.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ When building a package that is in a `git` repository,
103103
When building a package that is not under version control,
104104
or that has no tags, `rustpkg` assumes the intended version is 0.1.
105105

106+
> **Note:** A future version of rustpkg will support semantic versions.
107+
> Also, a future version will add the option to specify a version with a metadata
108+
> attribute like `#[link(vers = "3.1415")]` inside the crate module,
109+
> though this attribute will never be mandatory.
110+
106111
# Dependencies
107112

108113
rustpkg infers dependencies from `extern mod` directives.

branches/try2/src/etc/zsh/_rust

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ _rustc_opts_switches=(
2727
--sysroot'[Override the system root]'
2828
--test'[Build a test harness]'
2929
--target'[Target triple cpu-manufacturer-kernel\[-os\] to compile]'
30-
--target-feature'[Target specific attributes (llc -mattr=help for detail)]'
30+
--target-cpu'[Select target processor (llc -mcpu=help for details)]'
31+
--target-feature'[Target specific attributes (llc -mattr=help for details)]'
3132
--android-cross-path'[The path to the Android NDK]'
3233
{-v,--version}'[Print version info and exit]'
3334
)

branches/try2/src/libextra/dlist.rs

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use std::cast;
2626
use std::ptr;
2727
use std::util;
2828
use std::iterator::{FromIterator, Extendable, Invert};
29+
use std::iterator;
2930

3031
use container::Deque;
3132

@@ -589,12 +590,27 @@ impl<A, T: Iterator<A>> Extendable<A, T> for DList<A> {
589590
impl<A: Eq> Eq for DList<A> {
590591
fn eq(&self, other: &DList<A>) -> bool {
591592
self.len() == other.len() &&
592-
self.iter().zip(other.iter()).all(|(a, b)| a.eq(b))
593+
iterator::order::eq(self.iter(), other.iter())
593594
}
594595

595-
#[inline]
596596
fn ne(&self, other: &DList<A>) -> bool {
597-
!self.eq(other)
597+
self.len() != other.len() &&
598+
iterator::order::ne(self.iter(), other.iter())
599+
}
600+
}
601+
602+
impl<A: Eq + Ord> Ord for DList<A> {
603+
fn lt(&self, other: &DList<A>) -> bool {
604+
iterator::order::lt(self.iter(), other.iter())
605+
}
606+
fn le(&self, other: &DList<A>) -> bool {
607+
iterator::order::le(self.iter(), other.iter())
608+
}
609+
fn gt(&self, other: &DList<A>) -> bool {
610+
iterator::order::gt(self.iter(), other.iter())
611+
}
612+
fn ge(&self, other: &DList<A>) -> bool {
613+
iterator::order::ge(self.iter(), other.iter())
598614
}
599615
}
600616

@@ -964,6 +980,48 @@ mod tests {
964980
assert_eq!(&n, &m);
965981
}
966982

983+
#[test]
984+
fn test_ord() {
985+
let n: DList<int> = list_from([]);
986+
let m = list_from([1,2,3]);
987+
assert!(n < m);
988+
assert!(m > n);
989+
assert!(n <= n);
990+
assert!(n >= n);
991+
}
992+
993+
#[test]
994+
fn test_ord_nan() {
995+
let nan = 0.0/0.0;
996+
let n = list_from([nan]);
997+
let m = list_from([nan]);
998+
assert!(!(n < m));
999+
assert!(!(n > m));
1000+
assert!(!(n <= m));
1001+
assert!(!(n >= m));
1002+
1003+
let n = list_from([nan]);
1004+
let one = list_from([1.0]);
1005+
assert!(!(n < one));
1006+
assert!(!(n > one));
1007+
assert!(!(n <= one));
1008+
assert!(!(n >= one));
1009+
1010+
let u = list_from([1.0,2.0,nan]);
1011+
let v = list_from([1.0,2.0,3.0]);
1012+
assert!(!(u < v));
1013+
assert!(!(u > v));
1014+
assert!(!(u <= v));
1015+
assert!(!(u >= v));
1016+
1017+
let s = list_from([1.0,2.0,4.0,2.0]);
1018+
let t = list_from([1.0,2.0,3.0,2.0]);
1019+
assert!(!(s < t));
1020+
assert!(s > one);
1021+
assert!(!(s <= one));
1022+
assert!(s >= one);
1023+
}
1024+
9671025
#[test]
9681026
fn test_fuzz() {
9691027
do 25.times {

branches/try2/src/libextra/treemap.rs

Lines changed: 46 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
1515

1616
use std::util::{swap, replace};
17-
use std::iterator::{FromIterator, Extendable};
17+
use std::iterator::{FromIterator, Extendable, Peekable};
18+
use std::cmp::Ordering;
1819

1920
// This is implemented as an AA tree, which is a simplified variation of
2021
// a red-black tree where red (horizontal) nodes can only be added
@@ -529,24 +530,24 @@ impl<T: TotalOrd> TreeSet<T> {
529530

530531
/// Visit the values (in-order) representing the difference
531532
pub fn difference<'a>(&'a self, other: &'a TreeSet<T>) -> Difference<'a, T> {
532-
Difference{a: Focus::new(self.iter()), b: Focus::new(other.iter())}
533+
Difference{a: self.iter().peekable(), b: other.iter().peekable()}
533534
}
534535

535536
/// Visit the values (in-order) representing the symmetric difference
536537
pub fn symmetric_difference<'a>(&'a self, other: &'a TreeSet<T>)
537538
-> SymDifference<'a, T> {
538-
SymDifference{a: Focus::new(self.iter()), b: Focus::new(other.iter())}
539+
SymDifference{a: self.iter().peekable(), b: other.iter().peekable()}
539540
}
540541

541542
/// Visit the values (in-order) representing the intersection
542543
pub fn intersection<'a>(&'a self, other: &'a TreeSet<T>)
543544
-> Intersection<'a, T> {
544-
Intersection{a: Focus::new(self.iter()), b: Focus::new(other.iter())}
545+
Intersection{a: self.iter().peekable(), b: other.iter().peekable()}
545546
}
546547

547548
/// Visit the values (in-order) representing the union
548549
pub fn union<'a>(&'a self, other: &'a TreeSet<T>) -> Union<'a, T> {
549-
Union{a: Focus::new(self.iter()), b: Focus::new(other.iter())}
550+
Union{a: self.iter().peekable(), b: other.iter().peekable()}
550551
}
551552
}
552553

@@ -560,61 +561,47 @@ pub struct TreeSetRevIterator<'self, T> {
560561
priv iter: TreeMapRevIterator<'self, T, ()>
561562
}
562563

563-
// Encapsulate an iterator and hold its latest value until stepped forward
564-
struct Focus<A, T> {
565-
priv iter: T,
566-
priv focus: Option<A>,
567-
}
568-
569-
impl<A, T: Iterator<A>> Focus<A, T> {
570-
fn new(mut it: T) -> Focus<A, T> {
571-
Focus{focus: it.next(), iter: it}
572-
}
573-
fn step(&mut self) {
574-
self.focus = self.iter.next()
575-
}
576-
}
577-
578564
/// Lazy iterator producing elements in the set difference (in-order)
579565
pub struct Difference<'self, T> {
580-
priv a: Focus<&'self T, TreeSetIterator<'self, T>>,
581-
priv b: Focus<&'self T, TreeSetIterator<'self, T>>,
566+
priv a: Peekable<&'self T, TreeSetIterator<'self, T>>,
567+
priv b: Peekable<&'self T, TreeSetIterator<'self, T>>,
582568
}
583569

584570
/// Lazy iterator producing elements in the set symmetric difference (in-order)
585571
pub struct SymDifference<'self, T> {
586-
priv a: Focus<&'self T, TreeSetIterator<'self, T>>,
587-
priv b: Focus<&'self T, TreeSetIterator<'self, T>>,
572+
priv a: Peekable<&'self T, TreeSetIterator<'self, T>>,
573+
priv b: Peekable<&'self T, TreeSetIterator<'self, T>>,
588574
}
589575

590576
/// Lazy iterator producing elements in the set intersection (in-order)
591577
pub struct Intersection<'self, T> {
592-
priv a: Focus<&'self T, TreeSetIterator<'self, T>>,
593-
priv b: Focus<&'self T, TreeSetIterator<'self, T>>,
578+
priv a: Peekable<&'self T, TreeSetIterator<'self, T>>,
579+
priv b: Peekable<&'self T, TreeSetIterator<'self, T>>,
594580
}
595581

596582
/// Lazy iterator producing elements in the set intersection (in-order)
597583
pub struct Union<'self, T> {
598-
priv a: Focus<&'self T, TreeSetIterator<'self, T>>,
599-
priv b: Focus<&'self T, TreeSetIterator<'self, T>>,
584+
priv a: Peekable<&'self T, TreeSetIterator<'self, T>>,
585+
priv b: Peekable<&'self T, TreeSetIterator<'self, T>>,
586+
}
587+
588+
/// Compare `x` and `y`, but return `short` if x is None and `long` if y is None
589+
fn cmp_opt<T: TotalOrd>(x: Option<&T>, y: Option<&T>,
590+
short: Ordering, long: Ordering) -> Ordering {
591+
match (x, y) {
592+
(None , _ ) => short,
593+
(_ , None ) => long,
594+
(Some(x1), Some(y1)) => x1.cmp(y1),
595+
}
600596
}
601597

602598
impl<'self, T: TotalOrd> Iterator<&'self T> for Difference<'self, T> {
603599
fn next(&mut self) -> Option<&'self T> {
604600
loop {
605-
match (self.a.focus, self.b.focus) {
606-
(None , _ ) => return None,
607-
(ret , None ) => { self.a.step(); return ret },
608-
(Some(a1), Some(b1)) => {
609-
let cmp = a1.cmp(b1);
610-
if cmp == Less {
611-
self.a.step();
612-
return Some(a1);
613-
} else {
614-
if cmp == Equal { self.a.step() }
615-
self.b.step();
616-
}
617-
}
601+
match cmp_opt(self.a.peek(), self.b.peek(), Less, Less) {
602+
Less => return self.a.next(),
603+
Equal => { self.a.next(); self.b.next(); }
604+
Greater => { self.b.next(); }
618605
}
619606
}
620607
}
@@ -623,23 +610,10 @@ impl<'self, T: TotalOrd> Iterator<&'self T> for Difference<'self, T> {
623610
impl<'self, T: TotalOrd> Iterator<&'self T> for SymDifference<'self, T> {
624611
fn next(&mut self) -> Option<&'self T> {
625612
loop {
626-
match (self.a.focus, self.b.focus) {
627-
(ret , None ) => { self.a.step(); return ret },
628-
(None , ret ) => { self.b.step(); return ret },
629-
(Some(a1), Some(b1)) => {
630-
let cmp = a1.cmp(b1);
631-
if cmp == Less {
632-
self.a.step();
633-
return Some(a1);
634-
} else {
635-
self.b.step();
636-
if cmp == Greater {
637-
return Some(b1);
638-
} else {
639-
self.a.step();
640-
}
641-
}
642-
}
613+
match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) {
614+
Less => return self.a.next(),
615+
Equal => { self.a.next(); self.b.next(); }
616+
Greater => return self.b.next(),
643617
}
644618
}
645619
}
@@ -648,20 +622,16 @@ impl<'self, T: TotalOrd> Iterator<&'self T> for SymDifference<'self, T> {
648622
impl<'self, T: TotalOrd> Iterator<&'self T> for Intersection<'self, T> {
649623
fn next(&mut self) -> Option<&'self T> {
650624
loop {
651-
match (self.a.focus, self.b.focus) {
652-
(None , _ ) => return None,
653-
(_ , None ) => return None,
654-
(Some(a1), Some(b1)) => {
655-
let cmp = a1.cmp(b1);
656-
if cmp == Less {
657-
self.a.step();
658-
} else {
659-
self.b.step();
660-
if cmp == Equal {
661-
return Some(a1);
662-
}
663-
}
664-
},
625+
let o_cmp = match (self.a.peek(), self.b.peek()) {
626+
(None , _ ) => None,
627+
(_ , None ) => None,
628+
(Some(a1), Some(b1)) => Some(a1.cmp(b1)),
629+
};
630+
match o_cmp {
631+
None => return None,
632+
Some(Less) => { self.a.next(); }
633+
Some(Equal) => { self.b.next(); return self.a.next() }
634+
Some(Greater) => { self.b.next(); }
665635
}
666636
}
667637
}
@@ -670,22 +640,10 @@ impl<'self, T: TotalOrd> Iterator<&'self T> for Intersection<'self, T> {
670640
impl<'self, T: TotalOrd> Iterator<&'self T> for Union<'self, T> {
671641
fn next(&mut self) -> Option<&'self T> {
672642
loop {
673-
match (self.a.focus, self.b.focus) {
674-
(ret , None) => { self.a.step(); return ret },
675-
(None , ret ) => { self.b.step(); return ret },
676-
(Some(a1), Some(b1)) => {
677-
let cmp = a1.cmp(b1);
678-
if cmp == Greater {
679-
self.b.step();
680-
return Some(b1);
681-
} else {
682-
self.a.step();
683-
if cmp == Equal {
684-
self.b.step();
685-
}
686-
return Some(a1);
687-
}
688-
}
643+
match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) {
644+
Less => return self.a.next(),
645+
Equal => { self.b.next(); return self.a.next() }
646+
Greater => return self.b.next(),
689647
}
690648
}
691649
}

branches/try2/src/librustc/back/abi.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ pub static tydesc_field_take_glue: uint = 2u;
4646
pub static tydesc_field_drop_glue: uint = 3u;
4747
pub static tydesc_field_free_glue: uint = 4u;
4848
pub static tydesc_field_visit_glue: uint = 5u;
49-
pub static n_tydesc_fields: uint = 6u;
49+
pub static tydesc_field_borrow_offset: uint = 6u;
50+
pub static n_tydesc_fields: uint = 7u;
5051

5152
// The two halves of a closure: code and environment.
5253
pub static fn_field_code: uint = 0u;

0 commit comments

Comments
 (0)