Skip to content

Commit 9d8a907

Browse files
committed
---
yaml --- r: 139417 b: refs/heads/try2 c: f814592 h: refs/heads/master i: 139415: b407075 v: v3
1 parent 1292151 commit 9d8a907

Some content is hidden

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

65 files changed

+1146
-1072
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: a3996c1626003472437b9c29e179583daf9e53bf
8+
refs/heads/try2: f81459211d0cf2738ed02f5c7fe24f56c8032960
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/RELEASES.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Version 0.6 (March 2013)
1+
Version 0.6 (April 2013)
22
---------------------------
33

44
* ~2100 changes, numerous bugfixes
@@ -62,6 +62,8 @@ Version 0.6 (March 2013)
6262
* Pattern matching over vectors improved and expanded
6363
* Typechecking of closure types has been overhauled to
6464
improve inference and eliminate unsoundness
65+
* Macros leave scope at the end of modules, unless that module is
66+
tagged with #[macro_escape]
6567

6668
* Libraries
6769
* Added big integers to `std::bigint`

branches/try2/configure

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,6 @@ case $CFG_OSTYPE in
308308
esac
309309

310310

311-
if [ -z "$CFG_CPUTYPE" ]
312-
then
313311
case $CFG_CPUTYPE in
314312

315313
i386 | i486 | i686 | i786 | x86)
@@ -327,7 +325,6 @@ case $CFG_CPUTYPE in
327325
*)
328326
err "unknown CPU type: $CFG_CPUTYPE"
329327
esac
330-
fi
331328

332329
# Detect 64 bit linux systems with 32 bit userland and force 32 bit compilation
333330
if [ $CFG_OSTYPE = unknown-linux-gnu -a $CFG_CPUTYPE = x86_64 ]
@@ -536,7 +533,7 @@ then
536533
LLVM_VERSION=$($LLVM_CONFIG --version)
537534

538535
case $LLVM_VERSION in
539-
(3.1svn|3.1|3.0svn|3.0)
536+
(3.2svn|3.2|3.1svn|3.1|3.0svn|3.0)
540537
msg "found ok version of LLVM: $LLVM_VERSION"
541538
;;
542539
(*)
@@ -575,7 +572,7 @@ fi
575572
CFG_PREFIX=${CFG_PREFIX%/}
576573
CFG_HOST_TRIPLES="$(echo $CFG_HOST_TRIPLES | tr ',' ' ')"
577574
CFG_TARGET_TRIPLES="$(echo $CFG_TARGET_TRIPLES | tr ',' ' ')"
578-
CFG_SUPPORTED_TARGET_TRIPLES="$(grep ^CC_*=* $CFG_SRC_DIR/mk/platform.mk | sed 's,^[^_]*_,,' | sed 's/\([^=]*\).*/\1/' | xargs)"
575+
CFG_SUPPORTED_TARGET_TRIPLES="$(grep ^CC_*=* $CFG_SRC_DIR/mk/platform.mk | sed -e 's/^CC_//' -e 's/\([^=]*\).*/\1/' | xargs)"
579576

580577
# copy host-triples to target-triples so that hosts are a subset of targets
581578
V_TEMP=""

branches/try2/src/libcore/cmp.rs

Lines changed: 63 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -21,86 +21,82 @@ and `Eq` to overload the `==` and `!=` operators.
2121
*/
2222

2323
/**
24-
* Trait for values that can be compared for equality
25-
* and inequality.
24+
* Trait for values that can be compared for equality and inequality.
2625
*
27-
* Eventually this may be simplified to only require
28-
* an `eq` method, with the other generated from
29-
* a default implementation. However it should
30-
* remain possible to implement `ne` separately, for
31-
* compatibility with floating-point NaN semantics
32-
* (cf. IEEE 754-2008 section 5.11).
26+
* This trait allows partial equality, where types can be unordered instead of strictly equal or
27+
* unequal. For example, with the built-in floating-point types `a == b` and `a != b` will both
28+
* evaluate to false if either `a` or `b` is NaN (cf. IEEE 754-2008 section 5.11).
29+
*
30+
* Eventually, this will be implemented by default for types that implement `TotalEq`.
3331
*/
3432
#[lang="eq"]
3533
pub trait Eq {
3634
fn eq(&self, other: &Self) -> bool;
3735
fn ne(&self, other: &Self) -> bool;
3836
}
3937

40-
#[deriving(Eq)]
41-
pub enum Ordering { Less, Equal, Greater }
42-
43-
/// Trait for types that form a total order
44-
pub trait TotalOrd {
45-
fn cmp(&self, other: &Self) -> Ordering;
38+
/// Trait for equality comparisons where `a == b` and `a != b` are strict inverses.
39+
pub trait TotalEq {
40+
fn equals(&self, other: &Self) -> bool;
4641
}
4742

48-
#[inline(always)]
49-
fn icmp<T: Ord>(a: &T, b: &T) -> Ordering {
50-
if *a < *b { Less }
51-
else if *a > *b { Greater }
52-
else { Equal }
53-
}
43+
macro_rules! totaleq_impl(
44+
($t:ty) => {
45+
impl TotalEq for $t {
46+
#[inline(always)]
47+
fn equals(&self, other: &$t) -> bool { *self == *other }
48+
}
49+
}
50+
)
5451

55-
impl TotalOrd for u8 {
56-
#[inline(always)]
57-
fn cmp(&self, other: &u8) -> Ordering { icmp(self, other) }
58-
}
52+
totaleq_impl!(bool)
5953

60-
impl TotalOrd for u16 {
61-
#[inline(always)]
62-
fn cmp(&self, other: &u16) -> Ordering { icmp(self, other) }
63-
}
54+
totaleq_impl!(u8)
55+
totaleq_impl!(u16)
56+
totaleq_impl!(u32)
57+
totaleq_impl!(u64)
6458

65-
impl TotalOrd for u32 {
66-
#[inline(always)]
67-
fn cmp(&self, other: &u32) -> Ordering { icmp(self, other) }
68-
}
59+
totaleq_impl!(i8)
60+
totaleq_impl!(i16)
61+
totaleq_impl!(i32)
62+
totaleq_impl!(i64)
6963

70-
impl TotalOrd for u64 {
71-
#[inline(always)]
72-
fn cmp(&self, other: &u64) -> Ordering { icmp(self, other) }
73-
}
64+
totaleq_impl!(int)
65+
totaleq_impl!(uint)
7466

75-
impl TotalOrd for i8 {
76-
#[inline(always)]
77-
fn cmp(&self, other: &i8) -> Ordering { icmp(self, other) }
78-
}
67+
#[deriving(Eq)]
68+
pub enum Ordering { Less, Equal, Greater }
7969

80-
impl TotalOrd for i16 {
81-
#[inline(always)]
82-
fn cmp(&self, other: &i16) -> Ordering { icmp(self, other) }
70+
/// Trait for types that form a total order
71+
pub trait TotalOrd: TotalEq {
72+
fn cmp(&self, other: &Self) -> Ordering;
8373
}
8474

85-
impl TotalOrd for i32 {
86-
#[inline(always)]
87-
fn cmp(&self, other: &i32) -> Ordering { icmp(self, other) }
88-
}
75+
macro_rules! totalord_impl(
76+
($t:ty) => {
77+
impl TotalOrd for $t {
78+
#[inline(always)]
79+
fn cmp(&self, other: &$t) -> Ordering {
80+
if *self < *other { Less }
81+
else if *self > *other { Greater }
82+
else { Equal }
83+
}
84+
}
85+
}
86+
)
8987

90-
impl TotalOrd for i64 {
91-
#[inline(always)]
92-
fn cmp(&self, other: &i64) -> Ordering { icmp(self, other) }
93-
}
88+
totalord_impl!(u8)
89+
totalord_impl!(u16)
90+
totalord_impl!(u32)
91+
totalord_impl!(u64)
9492

95-
impl TotalOrd for int {
96-
#[inline(always)]
97-
fn cmp(&self, other: &int) -> Ordering { icmp(self, other) }
98-
}
93+
totalord_impl!(i8)
94+
totalord_impl!(i16)
95+
totalord_impl!(i32)
96+
totalord_impl!(i64)
9997

100-
impl TotalOrd for uint {
101-
#[inline(always)]
102-
fn cmp(&self, other: &uint) -> Ordering { icmp(self, other) }
103-
}
98+
totalord_impl!(int)
99+
totalord_impl!(uint)
104100

105101
/**
106102
* Trait for values that can be compared for a sort-order.
@@ -171,11 +167,17 @@ pub fn max<T:Ord>(v1: T, v2: T) -> T {
171167
#[cfg(test)]
172168
mod test {
173169
#[test]
174-
fn test_int() {
170+
fn test_int_totalord() {
175171
assert_eq!(5.cmp(&10), Less);
176172
assert_eq!(10.cmp(&5), Greater);
177173
assert_eq!(5.cmp(&5), Equal);
178174
assert_eq!((-5).cmp(&12), Less);
179175
assert_eq!(12.cmp(-5), Greater);
180176
}
177+
178+
#[test]
179+
fn test_int_totaleq() {
180+
fail_unless!(5.equals(&5));
181+
fail_unless!(!2.equals(&17));
182+
}
181183
}

branches/try2/src/libcore/hashmap.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Sendable hash maps.
11+
//! An unordered map and set type implemented as hash tables
12+
//!
13+
//! The tables use a keyed hash with new random keys generated for each container, so the ordering
14+
//! of a set of keys in a hash table is randomized.
1215
1316
/// Open addressing with linear probing.
1417
pub mod linear {

branches/try2/src/libcore/nil.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -15,7 +15,7 @@ Functions for the unit type.
1515
*/
1616

1717
#[cfg(notest)]
18-
use cmp::{Eq, Ord, TotalOrd, Ordering, Equal};
18+
use prelude::*;
1919

2020
#[cfg(notest)]
2121
impl Eq for () {
@@ -42,3 +42,9 @@ impl TotalOrd for () {
4242
#[inline(always)]
4343
fn cmp(&self, _other: &()) -> Ordering { Equal }
4444
}
45+
46+
#[cfg(notest)]
47+
impl TotalEq for () {
48+
#[inline(always)]
49+
fn equals(&self, _other: &()) -> bool { true }
50+
}

branches/try2/src/libcore/ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// Core operators
11+
//! Traits for the built-in operators
1212
1313
#[lang="drop"]
1414
pub trait Drop {

branches/try2/src/libcore/prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub use result::{Result, Ok, Err};
2424
/* Reexported types and traits */
2525

2626
pub use clone::Clone;
27-
pub use cmp::{Eq, Ord, TotalOrd, Ordering, Less, Equal, Greater};
27+
pub use cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater};
2828
pub use container::{Container, Mutable, Map, Set};
2929
pub use hash::Hash;
3030
pub use iter::{BaseIter, ReverseIter, MutableIter, ExtendedIter, EqIter};

branches/try2/src/libcore/rt/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, sp:
126126
type Registers = [uint, ..22];
127127

128128
#[cfg(target_arch = "x86_64")]
129-
fn new_regs() -> ~Registers { ~[0, .. 22] }
129+
fn new_regs() -> ~Registers { ~([0, .. 22]) }
130130

131131
#[cfg(target_arch = "x86_64")]
132132
fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, sp: *mut uint) {

branches/try2/src/libcore/stackwalk.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ fn breakpoint() {
8080
}
8181
}
8282

83-
fn frame_address(f: &fn(++x: *u8)) {
83+
fn frame_address(f: &fn(x: *u8)) {
8484
unsafe {
8585
rusti::frame_address(f)
8686
}
@@ -95,7 +95,7 @@ pub mod rustrt {
9595
pub mod rusti {
9696
#[abi = "rust-intrinsic"]
9797
pub extern {
98-
pub fn frame_address(f: &once fn(++x: *u8));
98+
pub fn frame_address(f: &once fn(x: *u8));
9999
}
100100
}
101101

branches/try2/src/libcore/str.rs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use at_vec;
2121
use cast;
2222
use char;
2323
use clone::Clone;
24-
use cmp::{Equiv, TotalOrd, Ordering, Less, Equal, Greater};
24+
use cmp::{Equiv, TotalEq, TotalOrd, Ordering, Less, Equal, Greater};
2525
use libc;
2626
use option::{None, Option, Some};
2727
use ptr;
@@ -726,7 +726,8 @@ pub fn each_split_within<'a>(ss: &'a str,
726726

727727
(B, Cr, UnderLim) => { B }
728728
(B, Cr, OverLim) if (i - last_start + 1) > lim
729-
=> { fail!(~"word longer than limit!") }
729+
=> fail!(fmt!("word starting with %? longer than limit!",
730+
self::slice(ss, last_start, i + 1))),
730731
(B, Cr, OverLim) => { slice(); slice_start = last_start; B }
731732
(B, Ws, UnderLim) => { last_end = i; C }
732733
(B, Ws, OverLim) => { last_end = i; slice(); A }
@@ -930,6 +931,30 @@ impl Eq for @str {
930931
fn ne(&self, other: &@str) -> bool { !(*self).eq(other) }
931932
}
932933

934+
#[cfg(notest)]
935+
impl<'self> TotalEq for &'self str {
936+
#[inline(always)]
937+
fn equals(&self, other: & &'self str) -> bool {
938+
eq_slice((*self), (*other))
939+
}
940+
}
941+
942+
#[cfg(notest)]
943+
impl TotalEq for ~str {
944+
#[inline(always)]
945+
fn equals(&self, other: &~str) -> bool {
946+
eq_slice((*self), (*other))
947+
}
948+
}
949+
950+
#[cfg(notest)]
951+
impl TotalEq for @str {
952+
#[inline(always)]
953+
fn equals(&self, other: &@str) -> bool {
954+
eq_slice((*self), (*other))
955+
}
956+
}
957+
933958
#[cfg(notest)]
934959
impl Ord for ~str {
935960
#[inline(always)]

0 commit comments

Comments
 (0)