Skip to content

Commit 9c388d5

Browse files
committed
---
yaml --- r: 128446 b: refs/heads/auto c: 1824973 h: refs/heads/master v: v3
1 parent 70eac4f commit 9c388d5

File tree

15 files changed

+253
-37
lines changed

15 files changed

+253
-37
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: d283574558b98b659997fd7bc97028158297388c
16+
refs/heads/auto: 1824973a139443b15e2c093b3e316169f2792cb3
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/doc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ for the 'std' and 'extra' libraries.
1919
To generate HTML documentation from one source file/crate, do something like:
2020

2121
~~~~
22-
rustdoc --output-dir html-doc/ --output-format html ../src/libstd/path.rs
22+
rustdoc --output html-doc/ --output-format html ../src/libstd/path.rs
2323
~~~~
2424

2525
(This, of course, requires a working build of the `rustdoc` tool.)

branches/auto/src/etc/emacs/rust-mode.el

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
(defconst rust-mode-keywords
171171
'("as"
172172
"box" "break"
173-
"continue" "crate"
173+
"const" "continue" "crate"
174174
"do"
175175
"else" "enum" "extern"
176176
"false" "fn" "for"
@@ -182,7 +182,8 @@
182182
"self" "static" "struct" "super"
183183
"true" "trait" "type"
184184
"unsafe" "use"
185-
"while"))
185+
"virtual"
186+
"where" "while"))
186187

187188
(defconst rust-special-types
188189
'("u8" "i8"

branches/auto/src/etc/gedit/share/gtksourceview-3.0/language-specs/rust.lang

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@
7171
<keyword>trait</keyword>
7272
<keyword>unsafe</keyword>
7373
<keyword>use</keyword>
74+
<keyword>virtual</keyword>
75+
<keyword>where</keyword>
7476
<keyword>while</keyword>
7577
</context>
7678

branches/auto/src/etc/kate/rust.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<item> as </item>
2020
<item> break </item>
2121
<item> box </item>
22+
<item> const </item>
2223
<item> continue </item>
2324
<item> crate </item>
2425
<item> do </item>
@@ -44,6 +45,8 @@
4445
<item> trait </item>
4546
<item> unsafe </item>
4647
<item> use </item>
48+
<item> virtual </item>
49+
<item> where </item>
4750
<item> while </item>
4851
</list>
4952
<list name="traits">

branches/auto/src/etc/vim/syntax/rust.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite skipempty
2626
syn keyword rustKeyword for in if impl let
2727
syn keyword rustKeyword loop once proc pub
2828
syn keyword rustKeyword return super
29-
syn keyword rustKeyword unsafe virtual while
29+
syn keyword rustKeyword unsafe virtual where while
3030
syn keyword rustKeyword use nextgroup=rustModPath,rustModPathInUse skipwhite skipempty
3131
" FIXME: Scoped impl's name is also fallen in this category
3232
syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite skipempty

branches/auto/src/libcollections/bitv.rs

Lines changed: 115 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,25 @@ use std::hash;
7575
use {Mutable, Set, MutableSet, MutableSeq};
7676
use vec::Vec;
7777

78+
// Take two BitV's, and return iterators of their words, where the shorter one
79+
// has been padded with 0's
80+
macro_rules! match_words(
81+
($a_expr:expr, $b_expr:expr) => ({
82+
let a = $a_expr;
83+
let b = $b_expr;
84+
let a_len = a.storage.len();
85+
let b_len = b.storage.len();
86+
87+
// have to uselessly pretend to pad the longer one for type matching
88+
if a_len < b_len {
89+
(a.mask_words(0).chain(iter::Repeat::new(0u).enumerate().take(b_len).skip(a_len)),
90+
b.mask_words(0).chain(iter::Repeat::new(0u).enumerate().take(0).skip(0)))
91+
} else {
92+
(a.mask_words(0).chain(iter::Repeat::new(0u).enumerate().take(0).skip(0)),
93+
b.mask_words(0).chain(iter::Repeat::new(0u).enumerate().take(a_len).skip(b_len)))
94+
}
95+
})
96+
)
7897

7998
static TRUE: bool = true;
8099
static FALSE: bool = false;
@@ -969,7 +988,7 @@ impl<'a> RandomAccessIterator<bool> for Bits<'a> {
969988
/// assert!(bv.eq_vec([true, true, false, true,
970989
/// false, false, false, false]));
971990
/// ```
972-
#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord)]
991+
#[deriving(Clone)]
973992
pub struct BitvSet(Bitv);
974993

975994
impl Default for BitvSet {
@@ -992,6 +1011,32 @@ impl Extendable<bool> for BitvSet {
9921011
}
9931012
}
9941013

1014+
impl PartialOrd for BitvSet {
1015+
#[inline]
1016+
fn partial_cmp(&self, other: &BitvSet) -> Option<Ordering> {
1017+
let (a_iter, b_iter) = match_words!(self.get_ref(), other.get_ref());
1018+
iter::order::partial_cmp(a_iter, b_iter)
1019+
}
1020+
}
1021+
1022+
impl Ord for BitvSet {
1023+
#[inline]
1024+
fn cmp(&self, other: &BitvSet) -> Ordering {
1025+
let (a_iter, b_iter) = match_words!(self.get_ref(), other.get_ref());
1026+
iter::order::cmp(a_iter, b_iter)
1027+
}
1028+
}
1029+
1030+
impl cmp::PartialEq for BitvSet {
1031+
#[inline]
1032+
fn eq(&self, other: &BitvSet) -> bool {
1033+
let (a_iter, b_iter) = match_words!(self.get_ref(), other.get_ref());
1034+
iter::order::eq(a_iter, b_iter)
1035+
}
1036+
}
1037+
1038+
impl cmp::Eq for BitvSet {}
1039+
9951040
impl BitvSet {
9961041
/// Create a new bit vector set with initially no contents.
9971042
///
@@ -1141,10 +1186,18 @@ impl BitvSet {
11411186
// Unwrap Bitvs
11421187
let &BitvSet(ref mut self_bitv) = self;
11431188
let &BitvSet(ref other_bitv) = other;
1189+
11441190
// Expand the vector if necessary
11451191
self_bitv.reserve(other_bitv.capacity());
1146-
// Apply values
1147-
for (i, w) in other_bitv.mask_words(0) {
1192+
1193+
// virtually pad other with 0's for equal lengths
1194+
let self_len = self_bitv.storage.len();
1195+
let other_len = other_bitv.storage.len();
1196+
let mut other_words = other_bitv.mask_words(0)
1197+
.chain(iter::Repeat::new(0u).enumerate().take(self_len).skip(other_len));
1198+
1199+
// Apply values found in other
1200+
for (i, w) in other_words {
11481201
let old = self_bitv.storage[i];
11491202
let new = f(old, w);
11501203
*self_bitv.storage.get_mut(i) = new;
@@ -1271,7 +1324,7 @@ impl BitvSet {
12711324
/// let a = BitvSet::from_bitv(bitv::from_bytes([0b01101000]));
12721325
/// let b = BitvSet::from_bitv(bitv::from_bytes([0b10100000]));
12731326
///
1274-
/// // Print 2, 4 in arbitrary order
1327+
/// // Print 1, 4 in arbitrary order
12751328
/// for x in a.difference(&b) {
12761329
/// println!("{}", x);
12771330
/// }
@@ -2213,6 +2266,64 @@ mod tests {
22132266
assert!(set1.is_subset(&set2)); // { 2 } { 2, 4 }
22142267
}
22152268

2269+
#[test]
2270+
fn test_bitv_set_intersect_with() {
2271+
// Explicitly 0'ed bits
2272+
let mut a = BitvSet::from_bitv(from_bytes([0b10100010]));
2273+
let mut b = BitvSet::from_bitv(from_bytes([0b00000000]));
2274+
let c = a.clone();
2275+
a.intersect_with(&b);
2276+
b.intersect_with(&c);
2277+
assert!(a.is_empty());
2278+
assert!(b.is_empty());
2279+
2280+
// Uninitialized bits should behave like 0's
2281+
let mut a = BitvSet::from_bitv(from_bytes([0b10100010]));
2282+
let mut b = BitvSet::new();
2283+
let c = a.clone();
2284+
a.intersect_with(&b);
2285+
b.intersect_with(&c);
2286+
assert!(a.is_empty());
2287+
assert!(b.is_empty());
2288+
2289+
// Standard
2290+
let mut a = BitvSet::from_bitv(from_bytes([0b10100010]));
2291+
let mut b = BitvSet::from_bitv(from_bytes([0b01100010]));
2292+
let c = a.clone();
2293+
a.intersect_with(&b);
2294+
b.intersect_with(&c);
2295+
assert_eq!(a.len(), 2);
2296+
assert_eq!(b.len(), 2);
2297+
}
2298+
2299+
#[test]
2300+
fn test_bitv_set_eq() {
2301+
let a = BitvSet::from_bitv(from_bytes([0b10100010]));
2302+
let b = BitvSet::from_bitv(from_bytes([0b00000000]));
2303+
let c = BitvSet::new();
2304+
2305+
assert!(a == a);
2306+
assert!(a != b);
2307+
assert!(a != c);
2308+
assert!(b == b);
2309+
assert!(b == c);
2310+
assert!(c == c);
2311+
}
2312+
2313+
#[test]
2314+
fn test_bitv_set_cmp() {
2315+
let a = BitvSet::from_bitv(from_bytes([0b10100010]));
2316+
let b = BitvSet::from_bitv(from_bytes([0b00000000]));
2317+
let c = BitvSet::new();
2318+
2319+
assert_eq!(a.cmp(&b), Greater);
2320+
assert_eq!(a.cmp(&c), Greater);
2321+
assert_eq!(b.cmp(&a), Less);
2322+
assert_eq!(b.cmp(&c), Equal);
2323+
assert_eq!(c.cmp(&a), Less);
2324+
assert_eq!(c.cmp(&b), Equal);
2325+
}
2326+
22162327
#[test]
22172328
fn test_bitv_remove() {
22182329
let mut a = BitvSet::new();

branches/auto/src/libcollections/btree.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
// btree.rs
1212
//
1313

14+
// NB. this is not deprecated for removal, just deprecating the
15+
// current implementation. If the major pain-points are addressed
16+
// (overuse of by-value self and .clone), this can be removed.
17+
#![deprecated = "the current implementation is extremely inefficient, \
18+
prefer a HashMap, TreeMap or TrieMap"]
19+
#![allow(deprecated)]
20+
1421
//! Starting implementation of a btree for rust.
1522
//! Structure inspired by github user davidhalperin's gist.
1623

branches/auto/src/libnum/bigint.rs

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
use Integer;
6060
use rand::Rng;
6161

62-
use std::{cmp, fmt};
62+
use std::{cmp, fmt, hash};
6363
use std::default::Default;
6464
use std::from_str::FromStr;
6565
use std::num::CheckedDiv;
@@ -150,6 +150,22 @@ impl Default for BigUint {
150150
fn default() -> BigUint { Zero::zero() }
151151
}
152152

153+
impl<S: hash::Writer> hash::Hash<S> for BigUint {
154+
fn hash(&self, state: &mut S) {
155+
// hash 0 in case it's all 0's
156+
0u32.hash(state);
157+
158+
let mut found_first_value = false;
159+
for elem in self.data.iter().rev() {
160+
// don't hash any leading 0's, they shouldn't affect the hash
161+
if found_first_value || *elem != 0 {
162+
found_first_value = true;
163+
elem.hash(state);
164+
}
165+
}
166+
}
167+
}
168+
153169
impl fmt::Show for BigUint {
154170
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
155171
write!(f, "{}", self.to_str_radix(10))
@@ -881,6 +897,13 @@ impl fmt::Show for BigInt {
881897
}
882898
}
883899

900+
impl<S: hash::Writer> hash::Hash<S> for BigInt {
901+
fn hash(&self, state: &mut S) {
902+
(self.sign == Plus).hash(state);
903+
self.data.hash(state);
904+
}
905+
}
906+
884907
impl FromStr for BigInt {
885908
#[inline]
886909
fn from_str(s: &str) -> Option<BigInt> {
@@ -1409,6 +1432,7 @@ mod biguint_tests {
14091432
use std::num::CheckedDiv;
14101433
use std::rand::task_rng;
14111434
use std::u64;
1435+
use std::hash::hash;
14121436

14131437
#[test]
14141438
fn test_from_slice() {
@@ -1460,6 +1484,19 @@ mod biguint_tests {
14601484
}
14611485
}
14621486

1487+
#[test]
1488+
fn test_hash() {
1489+
let a = BigUint::new(vec!());
1490+
let b = BigUint::new(vec!(0));
1491+
let c = BigUint::new(vec!(1));
1492+
let d = BigUint::new(vec!(1,0,0,0,0,0));
1493+
let e = BigUint::new(vec!(0,0,0,0,0,1));
1494+
assert!(hash(&a) == hash(&b));
1495+
assert!(hash(&b) != hash(&c));
1496+
assert!(hash(&c) == hash(&d));
1497+
assert!(hash(&d) != hash(&e));
1498+
}
1499+
14631500
#[test]
14641501
fn test_bitand() {
14651502
fn check(left: &[BigDigit],
@@ -2257,6 +2294,7 @@ mod bigint_tests {
22572294
use std::num::{ToPrimitive, FromPrimitive};
22582295
use std::rand::task_rng;
22592296
use std::u64;
2297+
use std::hash::hash;
22602298

22612299
#[test]
22622300
fn test_from_biguint() {
@@ -2314,6 +2352,21 @@ mod bigint_tests {
23142352
}
23152353
}
23162354

2355+
#[test]
2356+
fn test_hash() {
2357+
let a = BigInt::new(Zero, vec!());
2358+
let b = BigInt::new(Zero, vec!(0));
2359+
let c = BigInt::new(Plus, vec!(1));
2360+
let d = BigInt::new(Plus, vec!(1,0,0,0,0,0));
2361+
let e = BigInt::new(Plus, vec!(0,0,0,0,0,1));
2362+
let f = BigInt::new(Minus, vec!(1));
2363+
assert!(hash(&a) == hash(&b));
2364+
assert!(hash(&b) != hash(&c));
2365+
assert!(hash(&c) == hash(&d));
2366+
assert!(hash(&d) != hash(&e));
2367+
assert!(hash(&c) != hash(&f));
2368+
}
2369+
23172370
#[test]
23182371
fn test_convert_i64() {
23192372
fn check(b1: BigInt, i: i64) {

branches/auto/src/libnum/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
//! [newt]: https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method
4444
4545
#![feature(macro_rules)]
46+
#![feature(default_type_params)]
4647

4748
#![crate_name = "num"]
4849
#![experimental]

branches/auto/src/librustc/back/link.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,9 @@ fn link_args(cmd: &mut Command,
14751475

14761476
// Always enable DEP (NX bit) when it is available
14771477
cmd.arg("-Wl,--nxcompat");
1478+
1479+
// Mark all dynamic libraries and executables as compatible with ASLR
1480+
cmd.arg("-Wl,--dynamicbase");
14781481
}
14791482

14801483
if sess.targ_cfg.os == abi::OsAndroid {

0 commit comments

Comments
 (0)