Skip to content

Commit a5176c6

Browse files
committed
---
yaml --- r: 145855 b: refs/heads/try2 c: 4e0822e h: refs/heads/master i: 145853: 6fd30a0 145851: 266d1ef 145847: 56df7d8 145839: 84976a6 145823: 9bc546d 145791: 3243fb8 v: v3
1 parent ea1d41d commit a5176c6

Some content is hidden

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

112 files changed

+1118
-2301
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: 2b978af227492b878a02b69300b3e7e3ce9ca7c5
8+
refs/heads/try2: 4e0822e2538bbff9d53c151adaf37ec1fe29de9e
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/Makefile.in

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,17 +147,11 @@ CFG_VERSION = $(CFG_RELEASE)
147147
# numbers and dots here
148148
CFG_VERSION_WIN = 0.9
149149

150-
# since $(CFG_GIT) may contain spaces (especially on Windows),
151-
# we need to escape them. (" " to r"\ ")
152-
# Note that $(subst ...) ignores space after `subst`,
153-
# so we use a hack: define $(SPACE) which contains space character.
154-
SPACE :=
155-
SPACE +=
156-
ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT))),)
157-
ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT_DIR))),)
158-
CFG_VERSION += $(shell git --git-dir='$(CFG_GIT_DIR)' log -1 \
150+
ifneq ($(wildcard $(CFG_GIT)),)
151+
ifneq ($(wildcard $(CFG_GIT_DIR)),)
152+
CFG_VERSION += $(shell git --git-dir=$(CFG_GIT_DIR) log -1 \
159153
--pretty=format:'(%h %ci)')
160-
CFG_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse HEAD)
154+
CFG_VER_HASH = $(shell git --git-dir=$(CFG_GIT_DIR) rev-parse HEAD)
161155
endif
162156
endif
163157

branches/try2/mk/rt.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ RUNTIME_CXXS_$(1)_$(2) := \
8686
rt/sync/lock_and_signal.cpp \
8787
rt/sync/rust_thread.cpp \
8888
rt/rust_builtin.cpp \
89+
rt/rust_rng.cpp \
8990
rt/rust_upcall.cpp \
9091
rt/rust_uv.cpp \
9192
rt/miniz.cpp \

branches/try2/src/compiletest/compiletest.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ pub fn parse_config(args: ~[~str]) -> config {
109109
compile_lib_path: matches.opt_str("compile-lib-path").unwrap(),
110110
run_lib_path: matches.opt_str("run-lib-path").unwrap(),
111111
rustc_path: opt_path(matches, "rustc-path"),
112-
clang_path: matches.opt_str("clang-path").map(|s| Path(s)),
113-
llvm_bin_path: matches.opt_str("llvm-bin-path").map(|s| Path(s)),
112+
clang_path: matches.opt_str("clang-path").map_move(|s| Path(s)),
113+
llvm_bin_path: matches.opt_str("llvm-bin-path").map_move(|s| Path(s)),
114114
src_base: opt_path(matches, "src-base"),
115115
build_base: opt_path(matches, "build-base"),
116116
aux_base: opt_path(matches, "aux-base"),
@@ -123,10 +123,10 @@ pub fn parse_config(args: ~[~str]) -> config {
123123
} else {
124124
None
125125
},
126-
logfile: matches.opt_str("logfile").map(|s| Path(s)),
127-
save_metrics: matches.opt_str("save-metrics").map(|s| Path(s)),
126+
logfile: matches.opt_str("logfile").map_move(|s| Path(s)),
127+
save_metrics: matches.opt_str("save-metrics").map_move(|s| Path(s)),
128128
ratchet_metrics:
129-
matches.opt_str("ratchet-metrics").map(|s| Path(s)),
129+
matches.opt_str("ratchet-metrics").map_move(|s| Path(s)),
130130
ratchet_noise_percent:
131131
matches.opt_str("ratchet-noise-percent").and_then(|s| from_str::<f64>(s)),
132132
runtool: matches.opt_str("runtool"),

branches/try2/src/libextra/base64.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ impl<'self> ToBase64 for &'self [u8] {
6464
*
6565
* ```rust
6666
* extern mod extra;
67-
* use extra::base64::{ToBase64, STANDARD};
67+
* use extra::base64::{ToBase64, standard};
6868
*
6969
* fn main () {
70-
* let str = [52,32].to_base64(STANDARD);
71-
* println!("base 64 output: {}", str);
70+
* let str = [52,32].to_base64(standard);
71+
* println!("{}", str);
7272
* }
7373
* ```
7474
*/
@@ -172,19 +172,16 @@ impl<'self> FromBase64 for &'self str {
172172
*
173173
* ```rust
174174
* extern mod extra;
175-
* use extra::base64::{ToBase64, FromBase64, STANDARD};
175+
* use extra::base64::{ToBase64, FromBase64, standard};
176176
* use std::str;
177177
*
178178
* fn main () {
179-
* let hello_str = bytes!("Hello, World").to_base64(STANDARD);
180-
* println!("base64 output: {}", hello_str);
181-
* let res = hello_str.from_base64();
182-
* if res.is_ok() {
183-
* let optBytes = str::from_utf8_opt(res.unwrap());
184-
* if optBytes.is_some() {
185-
* println!("decoded from base64: {}", optBytes.unwrap());
186-
* }
187-
* }
179+
* let hello_str = "Hello, World".to_base64(standard);
180+
* println!("{}", hello_str);
181+
* let bytes = hello_str.from_base64();
182+
* println!("{:?}", bytes);
183+
* let result_str = str::from_utf8(bytes);
184+
* println!("{}", result_str);
188185
* }
189186
* ```
190187
*/

branches/try2/src/libextra/bitv.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,16 +1524,16 @@ mod tests {
15241524
}
15251525

15261526
fn rng() -> rand::IsaacRng {
1527-
let seed = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
1528-
rand::SeedableRng::from_seed(seed)
1527+
let seed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
1528+
rand::IsaacRng::new_seeded(seed)
15291529
}
15301530

15311531
#[bench]
15321532
fn bench_uint_small(b: &mut BenchHarness) {
15331533
let mut r = rng();
15341534
let mut bitv = 0 as uint;
15351535
do b.iter {
1536-
bitv |= (1 << ((r.next_u32() as uint) % uint::bits));
1536+
bitv |= (1 << ((r.next() as uint) % uint::bits));
15371537
}
15381538
}
15391539

@@ -1542,7 +1542,7 @@ mod tests {
15421542
let mut r = rng();
15431543
let mut bitv = SmallBitv::new(uint::bits);
15441544
do b.iter {
1545-
bitv.set((r.next_u32() as uint) % uint::bits, true);
1545+
bitv.set((r.next() as uint) % uint::bits, true);
15461546
}
15471547
}
15481548

@@ -1551,7 +1551,7 @@ mod tests {
15511551
let mut r = rng();
15521552
let mut bitv = BigBitv::new(~[0]);
15531553
do b.iter {
1554-
bitv.set((r.next_u32() as uint) % uint::bits, true);
1554+
bitv.set((r.next() as uint) % uint::bits, true);
15551555
}
15561556
}
15571557

@@ -1562,7 +1562,7 @@ mod tests {
15621562
storage.grow(BENCH_BITS / uint::bits, &0u);
15631563
let mut bitv = BigBitv::new(storage);
15641564
do b.iter {
1565-
bitv.set((r.next_u32() as uint) % BENCH_BITS, true);
1565+
bitv.set((r.next() as uint) % BENCH_BITS, true);
15661566
}
15671567
}
15681568

@@ -1571,7 +1571,7 @@ mod tests {
15711571
let mut r = rng();
15721572
let mut bitv = Bitv::new(BENCH_BITS, false);
15731573
do b.iter {
1574-
bitv.set((r.next_u32() as uint) % BENCH_BITS, true);
1574+
bitv.set((r.next() as uint) % BENCH_BITS, true);
15751575
}
15761576
}
15771577

@@ -1580,7 +1580,7 @@ mod tests {
15801580
let mut r = rng();
15811581
let mut bitv = Bitv::new(uint::bits, false);
15821582
do b.iter {
1583-
bitv.set((r.next_u32() as uint) % uint::bits, true);
1583+
bitv.set((r.next() as uint) % uint::bits, true);
15841584
}
15851585
}
15861586

@@ -1589,7 +1589,7 @@ mod tests {
15891589
let mut r = rng();
15901590
let mut bitv = BitvSet::new();
15911591
do b.iter {
1592-
bitv.insert((r.next_u32() as uint) % uint::bits);
1592+
bitv.insert((r.next() as uint) % uint::bits);
15931593
}
15941594
}
15951595

@@ -1598,7 +1598,7 @@ mod tests {
15981598
let mut r = rng();
15991599
let mut bitv = BitvSet::new();
16001600
do b.iter {
1601-
bitv.insert((r.next_u32() as uint) % BENCH_BITS);
1601+
bitv.insert((r.next() as uint) % BENCH_BITS);
16021602
}
16031603
}
16041604

branches/try2/src/libextra/comm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl<T: Send> GenericPort<T> for SyncPort<T> {
114114
}
115115

116116
fn try_recv(&self) -> Option<T> {
117-
do self.duplex_stream.try_recv().map |val| {
117+
do self.duplex_stream.try_recv().map_move |val| {
118118
self.duplex_stream.try_send(());
119119
val
120120
}

branches/try2/src/libextra/dlist.rs

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl<T> DList<T> {
165165
/// Remove the first Node and return it, or None if the list is empty
166166
#[inline]
167167
fn pop_front_node(&mut self) -> Option<~Node<T>> {
168-
do self.list_head.take().map |mut front_node| {
168+
do self.list_head.take().map_move |mut front_node| {
169169
self.length -= 1;
170170
match front_node.next.take() {
171171
Some(node) => self.list_head = link_with_prev(node, Rawlink::none()),
@@ -191,7 +191,7 @@ impl<T> DList<T> {
191191
/// Remove the last Node and return it, or None if the list is empty
192192
#[inline]
193193
fn pop_back_node(&mut self) -> Option<~Node<T>> {
194-
do self.list_tail.resolve().map_default(None) |tail| {
194+
do self.list_tail.resolve().map_move_default(None) |tail| {
195195
self.length -= 1;
196196
self.list_tail = tail.prev;
197197
match tail.prev.resolve() {
@@ -206,27 +206,25 @@ impl<T> Deque<T> for DList<T> {
206206
/// Provide a reference to the front element, or None if the list is empty
207207
#[inline]
208208
fn front<'a>(&'a self) -> Option<&'a T> {
209-
self.list_head.as_ref().map(|head| &head.value)
209+
self.list_head.map(|head| &head.value)
210210
}
211211

212212
/// Provide a mutable reference to the front element, or None if the list is empty
213213
#[inline]
214214
fn front_mut<'a>(&'a mut self) -> Option<&'a mut T> {
215-
self.list_head.as_mut().map(|head| &mut head.value)
215+
self.list_head.map_mut(|head| &mut head.value)
216216
}
217217

218218
/// Provide a reference to the back element, or None if the list is empty
219219
#[inline]
220220
fn back<'a>(&'a self) -> Option<&'a T> {
221-
let tmp = self.list_tail.resolve_immut(); // FIXME: #3511: shouldn't need variable
222-
tmp.as_ref().map(|tail| &tail.value)
221+
self.list_tail.resolve_immut().map(|tail| &tail.value)
223222
}
224223

225224
/// Provide a mutable reference to the back element, or None if the list is empty
226225
#[inline]
227226
fn back_mut<'a>(&'a mut self) -> Option<&'a mut T> {
228-
let mut tmp = self.list_tail.resolve(); // FIXME: #3511: shouldn't need variable
229-
tmp.as_mut().map(|tail| &mut tail.value)
227+
self.list_tail.resolve().map_mut(|tail| &mut tail.value)
230228
}
231229

232230
/// Add an element first in the list
@@ -240,7 +238,7 @@ impl<T> Deque<T> for DList<T> {
240238
///
241239
/// O(1)
242240
fn pop_front(&mut self) -> Option<T> {
243-
self.pop_front_node().map(|~Node{value, _}| value)
241+
self.pop_front_node().map_move(|~Node{value, _}| value)
244242
}
245243

246244
/// Add an element last in the list
@@ -254,7 +252,7 @@ impl<T> Deque<T> for DList<T> {
254252
///
255253
/// O(1)
256254
fn pop_back(&mut self) -> Option<T> {
257-
self.pop_back_node().map(|~Node{value, _}| value)
255+
self.pop_back_node().map_move(|~Node{value, _}| value)
258256
}
259257
}
260258

@@ -270,7 +268,7 @@ impl<T> DList<T> {
270268
/// If the list is empty, do nothing.
271269
#[inline]
272270
pub fn rotate_forward(&mut self) {
273-
do self.pop_back_node().map |tail| {
271+
do self.pop_back_node().map_move |tail| {
274272
self.push_front_node(tail)
275273
};
276274
}
@@ -280,7 +278,7 @@ impl<T> DList<T> {
280278
/// If the list is empty, do nothing.
281279
#[inline]
282280
pub fn rotate_backward(&mut self) {
283-
do self.pop_front_node().map |head| {
281+
do self.pop_front_node().map_move |head| {
284282
self.push_back_node(head)
285283
};
286284
}
@@ -444,7 +442,7 @@ impl<'self, A> Iterator<&'self A> for DListIterator<'self, A> {
444442
if self.nelem == 0 {
445443
return None;
446444
}
447-
do self.head.as_ref().map |head| {
445+
do self.head.map |head| {
448446
self.nelem -= 1;
449447
self.head = &head.next;
450448
&head.value
@@ -463,8 +461,7 @@ impl<'self, A> DoubleEndedIterator<&'self A> for DListIterator<'self, A> {
463461
if self.nelem == 0 {
464462
return None;
465463
}
466-
let tmp = self.tail.resolve_immut(); // FIXME: #3511: shouldn't need variable
467-
do tmp.as_ref().map |prev| {
464+
do self.tail.resolve().map_move |prev| {
468465
self.nelem -= 1;
469466
self.tail = prev.prev;
470467
&prev.value
@@ -480,7 +477,7 @@ impl<'self, A> Iterator<&'self mut A> for MutDListIterator<'self, A> {
480477
if self.nelem == 0 {
481478
return None;
482479
}
483-
do self.head.resolve().map |next| {
480+
do self.head.resolve().map_move |next| {
484481
self.nelem -= 1;
485482
self.head = match next.next {
486483
Some(ref mut node) => Rawlink::some(&mut **node),
@@ -502,7 +499,7 @@ impl<'self, A> DoubleEndedIterator<&'self mut A> for MutDListIterator<'self, A>
502499
if self.nelem == 0 {
503500
return None;
504501
}
505-
do self.tail.resolve().map |prev| {
502+
do self.tail.resolve().map_move |prev| {
506503
self.nelem -= 1;
507504
self.tail = prev.prev;
508505
&mut prev.value
@@ -557,7 +554,7 @@ impl<'self, A> ListInsertion<A> for MutDListIterator<'self, A> {
557554
if self.nelem == 0 {
558555
return None
559556
}
560-
self.head.resolve().map(|head| &mut head.value)
557+
self.head.resolve().map_move(|head| &mut head.value)
561558
}
562559
}
563560

branches/try2/src/libextra/fileinput.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,8 @@ mod test {
596596
|i| format!("tmp/lib-fileinput-test-next-file-{}.tmp", i)),true);
597597
598598
for (i, filename) in filenames.iter().enumerate() {
599-
let contents = vec::from_fn(3, |j| format!("{} {}", i, j + 1));
599+
let contents =
600+
vec::from_fn(3, |j| format!("{} {}", i, j + 1));
600601
make_file(filename.get_ref(), contents);
601602
}
602603

branches/try2/src/libextra/num/bigint.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ impl BigUint {
698698
#[inline]
699699
pub fn new(v: ~[BigDigit]) -> BigUint {
700700
// omit trailing zeros
701-
let new_len = v.iter().rposition(|n| *n != 0).map_default(0, |p| p + 1);
701+
let new_len = v.iter().rposition(|n| *n != 0).map_move_default(0, |p| p + 1);
702702

703703
if new_len == v.len() { return BigUint { data: v }; }
704704
let mut v = v;
@@ -1417,7 +1417,7 @@ impl BigInt {
14171417
start = 1;
14181418
}
14191419
return BigUint::parse_bytes(buf.slice(start, buf.len()), radix)
1420-
.map(|bu| BigInt::from_biguint(sign, bu));
1420+
.map_move(|bu| BigInt::from_biguint(sign, bu));
14211421
}
14221422
14231423
/// Converts this `BigInt` into a `BigUint`, if it's not negative.
@@ -2507,7 +2507,7 @@ mod bigint_tests {
25072507
#[test]
25082508
fn test_from_str_radix() {
25092509
fn check(s: &str, ans: Option<int>) {
2510-
let ans = ans.map(|n| {
2510+
let ans = ans.map_move(|n| {
25112511
let x: BigInt = FromPrimitive::from_int(n).unwrap();
25122512
x
25132513
});

branches/try2/src/libextra/smallintmap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ impl<V> SmallIntMap<V> {
158158
{
159159
let values = replace(&mut self.v, ~[]);
160160
values.move_iter().enumerate().filter_map(|(i, v)| {
161-
v.map(|v| (i, v))
161+
v.map_move(|v| (i, v))
162162
})
163163
}
164164
}

branches/try2/src/libextra/term.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl Terminal {
127127
let inf = ti.unwrap();
128128
let nc = if inf.strings.find_equiv(&("setaf")).is_some()
129129
&& inf.strings.find_equiv(&("setab")).is_some() {
130-
inf.numbers.find_equiv(&("colors")).map_default(0, |&n| n)
130+
inf.numbers.find_equiv(&("colors")).map_move_default(0, |&n| n)
131131
} else { 0 };
132132

133133
return Ok(Terminal {out: out, ti: inf, num_colors: nc});
@@ -220,7 +220,7 @@ impl Terminal {
220220
cap = self.ti.strings.find_equiv(&("op"));
221221
}
222222
}
223-
let s = do cap.map_default(Err(~"can't find terminfo capability `sgr0`")) |op| {
223+
let s = do cap.map_move_default(Err(~"can't find terminfo capability `sgr0`")) |op| {
224224
expand(*op, [], &mut Variables::new())
225225
};
226226
if s.is_ok() {

0 commit comments

Comments
 (0)