Skip to content

Commit bd6710c

Browse files
committed
---
yaml --- r: 150909 b: refs/heads/try2 c: 30ff17f h: refs/heads/master i: 150907: 8b8b736 v: v3
1 parent f1f2af1 commit bd6710c

File tree

109 files changed

+1421
-1132
lines changed

Some content is hidden

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

109 files changed

+1421
-1132
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: b75683cadf6c4c55360202cd6a0106be80532451
8+
refs/heads/try2: 30ff17f809869dec37d7b501fb532dc88fd47832
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ documentation.
2525
* `perl` 5.0 or later
2626
* GNU `make` 3.81 or later
2727
* `curl`
28-
* `git`
2928
2. Download and build Rust:
3029

3130
You can either download a [tarball] or build directly from the [repo].

branches/try2/configure

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -921,10 +921,6 @@ do
921921
LLVM_OPTS="$LLVM_OPTS --disable-terminfo"
922922
# Try to have LLVM pull in as few dependencies as possible (#9397)
923923
LLVM_OPTS="$LLVM_OPTS --disable-zlib --disable-libffi"
924-
# LLVM says it needs a "new" clang/gcc, but we seem to get by ok with
925-
# older versions on the bots. Get by for a little longer by asking it to
926-
# not do version detection
927-
LLVM_OPTS="$LLVM_OPTS --disable-compiler-version-checks"
928924

929925
# Use win32 native thread/lock apis instead of pthread wrapper.
930926
# (llvm's configure tries to find pthread first, so we have to disable it explicitly.)

branches/try2/mk/tests.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
568568
--host $(3) \
569569
--adb-path=$(CFG_ADB) \
570570
--adb-test-dir=$(CFG_ADB_TEST_DIR) \
571-
--host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(3))" \
571+
--host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
572572
--target-rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
573573
$$(CTEST_TESTARGS)
574574

branches/try2/src/compiletest/runtest.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use std::os;
3333
use std::str;
3434
use std::strbuf::StrBuf;
3535
use std::task;
36+
use std::slice;
3637
use test::MetricMap;
3738

3839
pub fn run(config: config, testfile: ~str) {
@@ -508,7 +509,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
508509
proc_res: &ProcRes) {
509510
510511
// true if we found the error in question
511-
let mut found_flags = Vec::from_elem(
512+
let mut found_flags = slice::from_elem(
512513
expected_errors.len(), false);
513514
514515
if proc_res.status.success() {
@@ -553,13 +554,13 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
553554
for line in proc_res.stderr.lines() {
554555
let mut was_expected = false;
555556
for (i, ee) in expected_errors.iter().enumerate() {
556-
if !*found_flags.get(i) {
557+
if !found_flags[i] {
557558
debug!("prefix={} ee.kind={} ee.msg={} line={}",
558559
*prefixes.get(i), ee.kind, ee.msg, line);
559560
if prefix_matches(line, *prefixes.get(i)) &&
560561
line.contains(ee.kind) &&
561562
line.contains(ee.msg) {
562-
*found_flags.get_mut(i) = true;
563+
found_flags[i] = true;
563564
was_expected = true;
564565
break;
565566
}

branches/try2/src/doc/guide-pointers.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,8 @@ great detail, so if you want the full details, check that out.
430430
# Returning Pointers
431431

432432
We've talked a lot about functions that accept various kinds of pointers, but
433-
what about returning them? In general, it is better to let the caller decide
434-
how to use a function's output, instead of assuming a certain type of pointer
435-
is best.
433+
what about returning them? Here's the rule of thumb: only return a unique or
434+
managed pointer if you were given one in the first place.
436435

437436
What does that mean? Don't do this:
438437

branches/try2/src/doc/guide-tasks.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,10 @@ might look like the example below.
255255

256256
~~~
257257
# use std::task::spawn;
258+
# use std::slice;
258259
259260
// Create a vector of ports, one for each child task
260-
let rxs = Vec::from_fn(3, |init_val| {
261+
let rxs = slice::from_fn(3, |init_val| {
261262
let (tx, rx) = channel();
262263
spawn(proc() {
263264
tx.send(some_expensive_computation(init_val));
@@ -303,6 +304,7 @@ be distributed on the available cores.
303304

304305
~~~
305306
# extern crate sync;
307+
# use std::slice;
306308
fn partial_sum(start: uint) -> f64 {
307309
let mut local_sum = 0f64;
308310
for num in range(start*100000, (start+1)*100000) {
@@ -312,7 +314,7 @@ fn partial_sum(start: uint) -> f64 {
312314
}
313315
314316
fn main() {
315-
let mut futures = Vec::from_fn(1000, |ind| sync::Future::spawn( proc() { partial_sum(ind) }));
317+
let mut futures = slice::from_fn(1000, |ind| sync::Future::spawn( proc() { partial_sum(ind) }));
316318
317319
let mut final_res = 0f64;
318320
for ft in futures.mut_iter() {
@@ -340,24 +342,25 @@ a single large vector of floats. Each task needs the full vector to perform its
340342
extern crate rand;
341343
extern crate sync;
342344
345+
use std::slice;
343346
use sync::Arc;
344347
345-
fn pnorm(nums: &[f64], p: uint) -> f64 {
348+
fn pnorm(nums: &~[f64], p: uint) -> f64 {
346349
nums.iter().fold(0.0, |a,b| a+(*b).powf(&(p as f64)) ).powf(&(1.0 / (p as f64)))
347350
}
348351
349352
fn main() {
350-
let numbers = Vec::from_fn(1000000, |_| rand::random::<f64>());
353+
let numbers = slice::from_fn(1000000, |_| rand::random::<f64>());
351354
let numbers_arc = Arc::new(numbers);
352355
353356
for num in range(1u, 10) {
354357
let (tx, rx) = channel();
355358
tx.send(numbers_arc.clone());
356359
357360
spawn(proc() {
358-
let local_arc : Arc<Vec<f64>> = rx.recv();
361+
let local_arc : Arc<~[f64]> = rx.recv();
359362
let task_numbers = &*local_arc;
360-
println!("{}-norm = {}", num, pnorm(task_numbers.as_slice(), num));
363+
println!("{}-norm = {}", num, pnorm(task_numbers, num));
361364
});
362365
}
363366
}
@@ -371,8 +374,9 @@ created by the line
371374
# extern crate sync;
372375
# extern crate rand;
373376
# use sync::Arc;
377+
# use std::slice;
374378
# fn main() {
375-
# let numbers = Vec::from_fn(1000000, |_| rand::random::<f64>());
379+
# let numbers = slice::from_fn(1000000, |_| rand::random::<f64>());
376380
let numbers_arc=Arc::new(numbers);
377381
# }
378382
~~~
@@ -383,8 +387,9 @@ and a clone of it is sent to each task
383387
# extern crate sync;
384388
# extern crate rand;
385389
# use sync::Arc;
390+
# use std::slice;
386391
# fn main() {
387-
# let numbers=Vec::from_fn(1000000, |_| rand::random::<f64>());
392+
# let numbers=slice::from_fn(1000000, |_| rand::random::<f64>());
388393
# let numbers_arc = Arc::new(numbers);
389394
# let (tx, rx) = channel();
390395
tx.send(numbers_arc.clone());
@@ -399,12 +404,13 @@ Each task recovers the underlying data by
399404
# extern crate sync;
400405
# extern crate rand;
401406
# use sync::Arc;
407+
# use std::slice;
402408
# fn main() {
403-
# let numbers=Vec::from_fn(1000000, |_| rand::random::<f64>());
409+
# let numbers=slice::from_fn(1000000, |_| rand::random::<f64>());
404410
# let numbers_arc=Arc::new(numbers);
405411
# let (tx, rx) = channel();
406412
# tx.send(numbers_arc.clone());
407-
# let local_arc : Arc<Vec<f64>> = rx.recv();
413+
# let local_arc : Arc<~[f64]> = rx.recv();
408414
let task_numbers = &*local_arc;
409415
# }
410416
~~~

branches/try2/src/doc/tutorial.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,12 +1582,12 @@ the elements are mutable if the vector is mutable.
15821582
use std::strbuf::StrBuf;
15831583

15841584
// A dynamically sized vector (unique vector)
1585-
let mut numbers = vec![1, 2, 3];
1585+
let mut numbers = ~[1, 2, 3];
15861586
numbers.push(4);
15871587
numbers.push(5);
15881588

15891589
// The type of a unique vector is written as `~[int]`
1590-
let more_numbers: ~[int] = numbers.move_iter().collect();
1590+
let more_numbers: ~[int] = numbers;
15911591

15921592
// The original `numbers` value can no longer be used, due to move semantics.
15931593

@@ -1955,8 +1955,8 @@ vector consisting of the result of applying `function` to each element
19551955
of `vector`:
19561956
19571957
~~~~
1958-
fn map<T, U>(vector: &[T], function: |v: &T| -> U) -> Vec<U> {
1959-
let mut accumulator = Vec::new();
1958+
fn map<T, U>(vector: &[T], function: |v: &T| -> U) -> ~[U] {
1959+
let mut accumulator = ~[];
19601960
for element in vector.iter() {
19611961
accumulator.push(function(element));
19621962
}

branches/try2/src/etc/vim/indent/rust.vim

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ function GetRustIndent(lnum)
105105
if prevline[len(prevline) - 1] == ","
106106
\ && s:get_line_trimmed(a:lnum) !~ "^\\s*[\\[\\]{}]"
107107
\ && prevline !~ "^\\s*fn\\s"
108-
\ && prevline !~ "\\([^\\(\\)]\+,$"
109108
" Oh ho! The previous line ended in a comma! I bet cindent will try to
110109
" take this too far... For now, let's normally use the previous line's
111110
" indent.
@@ -120,16 +119,6 @@ function GetRustIndent(lnum)
120119
" fn foo(baz: Baz,
121120
" baz: Baz) // <-- cindent gets this right by itself
122121
"
123-
" Another case is similar to the previous, except calling a function
124-
" instead of defining it, or any conditional expression that leaves
125-
" an open paren:
126-
"
127-
" foo(baz,
128-
" baz);
129-
"
130-
" if baz && (foo ||
131-
" bar) {
132-
"
133122
" There are probably other cases where we don't want to do this as
134123
" well. Add them as needed.
135124
return GetRustIndent(a:lnum - 1)

branches/try2/src/libcollections/bitv.rs

Lines changed: 14 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ impl SmallBitv {
9797
pub fn set_all(&mut self) { self.bits = !0; }
9898

9999
#[inline]
100-
pub fn all(&self, nbits: uint) -> bool {
100+
pub fn is_true(&self, nbits: uint) -> bool {
101101
small_mask(nbits) & !self.bits == 0
102102
}
103103

104104
#[inline]
105-
pub fn none(&self, nbits: uint) -> bool {
105+
pub fn is_false(&self, nbits: uint) -> bool {
106106
small_mask(nbits) & self.bits == 0
107107
}
108108

@@ -412,10 +412,13 @@ impl Bitv {
412412

413413
/// Returns `true` if all bits are 1
414414
#[inline]
415-
pub fn all(&self) -> bool {
415+
pub fn is_true(&self) -> bool {
416416
match self.rep {
417-
Small(ref b) => b.all(self.nbits),
418-
_ => self.iter().all(|x| x)
417+
Small(ref b) => b.is_true(self.nbits),
418+
_ => {
419+
for i in self.iter() { if !i { return false; } }
420+
true
421+
}
419422
}
420423
}
421424

@@ -430,19 +433,16 @@ impl Bitv {
430433
}
431434

432435
/// Returns `true` if all bits are 0
433-
pub fn none(&self) -> bool {
436+
pub fn is_false(&self) -> bool {
434437
match self.rep {
435-
Small(ref b) => b.none(self.nbits),
436-
_ => self.iter().all(|x| !x)
438+
Small(ref b) => b.is_false(self.nbits),
439+
Big(_) => {
440+
for i in self.iter() { if i { return false; } }
441+
true
442+
}
437443
}
438444
}
439445

440-
#[inline]
441-
/// Returns `true` if any bit is 1
442-
pub fn any(&self) -> bool {
443-
!self.none()
444-
}
445-
446446
pub fn init_to_vec(&self, i: uint) -> uint {
447447
return if self.get(i) { 1 } else { 0 };
448448
}
@@ -1551,51 +1551,6 @@ mod tests {
15511551
assert!(b.contains(&1000));
15521552
}
15531553

1554-
#[test]
1555-
fn test_small_bitv_tests() {
1556-
let v = from_bytes([0]);
1557-
assert!(!v.all());
1558-
assert!(!v.any());
1559-
assert!(v.none());
1560-
1561-
let v = from_bytes([0b00010100]);
1562-
assert!(!v.all());
1563-
assert!(v.any());
1564-
assert!(!v.none());
1565-
1566-
let v = from_bytes([0xFF]);
1567-
assert!(v.all());
1568-
assert!(v.any());
1569-
assert!(!v.none());
1570-
}
1571-
1572-
#[test]
1573-
fn test_big_bitv_tests() {
1574-
let v = from_bytes([ // 88 bits
1575-
0, 0, 0, 0,
1576-
0, 0, 0, 0,
1577-
0, 0, 0]);
1578-
assert!(!v.all());
1579-
assert!(!v.any());
1580-
assert!(v.none());
1581-
1582-
let v = from_bytes([ // 88 bits
1583-
0, 0, 0b00010100, 0,
1584-
0, 0, 0, 0b00110100,
1585-
0, 0, 0]);
1586-
assert!(!v.all());
1587-
assert!(v.any());
1588-
assert!(!v.none());
1589-
1590-
let v = from_bytes([ // 88 bits
1591-
0xFF, 0xFF, 0xFF, 0xFF,
1592-
0xFF, 0xFF, 0xFF, 0xFF,
1593-
0xFF, 0xFF, 0xFF]);
1594-
assert!(v.all());
1595-
assert!(v.any());
1596-
assert!(!v.none());
1597-
}
1598-
15991554
fn rng() -> rand::IsaacRng {
16001555
let seed = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
16011556
rand::SeedableRng::from_seed(seed)

branches/try2/src/libnative/io/addrinfo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl GetAddrInfoRequest {
5757
}
5858

5959
// Collect all the results we found
60-
let mut addrs = Vec::new();
60+
let mut addrs = ~[];
6161
let mut rp = res;
6262
while rp.is_not_null() {
6363
unsafe {
@@ -80,7 +80,7 @@ impl GetAddrInfoRequest {
8080

8181
unsafe { freeaddrinfo(res); }
8282

83-
Ok(addrs.move_iter().collect())
83+
Ok(addrs)
8484
}
8585
}
8686

branches/try2/src/libnative/io/file_unix.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use libc::{c_int, c_void};
1818
use libc;
1919
use std::mem;
2020
use std::rt::rtio;
21+
use std::slice;
2122

2223
use io::{IoResult, retry, keep_going};
2324

@@ -415,7 +416,7 @@ pub fn readlink(p: &CString) -> IoResult<Path> {
415416
if len == -1 {
416417
len = 1024; // FIXME: read PATH_MAX from C ffi?
417418
}
418-
let mut buf: Vec<u8> = Vec::with_capacity(len as uint);
419+
let mut buf = slice::with_capacity::<u8>(len as uint);
419420
match retry(|| unsafe {
420421
libc::readlink(p, buf.as_ptr() as *mut libc::c_char,
421422
len as libc::size_t) as libc::c_int

0 commit comments

Comments
 (0)