Skip to content

Commit accd76f

Browse files
committed
---
yaml --- r: 150743 b: refs/heads/try2 c: ab0d847 h: refs/heads/master i: 150741: fb798df 150739: 78de0d2 150735: ee6a659 v: v3
1 parent 6545643 commit accd76f

File tree

135 files changed

+2135
-2097
lines changed

Some content is hidden

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

135 files changed

+2135
-2097
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: 545d4718c8e1b9e69474165a1cb38d873627183d
8+
refs/heads/try2: ab0d8472777d2359492dfdee1d21230fbf144f70
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/compiletest/runtest.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use std::io::timer;
3131
use std::io;
3232
use std::os;
3333
use std::str;
34+
use std::strbuf::StrBuf;
3435
use std::task;
3536
use std::slice;
3637
use test::MetricMap;
@@ -328,10 +329,10 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
328329
}
329330

330331
let args = split_maybe_args(&config.target_rustcflags);
331-
let mut tool_path:~str = ~"";
332+
let mut tool_path = StrBuf::new();
332333
for arg in args.iter() {
333334
if arg.contains("android-cross-path=") {
334-
tool_path = arg.replace("android-cross-path=","");
335+
tool_path = StrBuf::from_str(arg.replace("android-cross-path=", ""));
335336
break;
336337
}
337338
}
@@ -348,7 +349,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
348349
let gdb_path = tool_path.append("/bin/arm-linux-androideabi-gdb");
349350
let procsrv::Result{ out, err, status }=
350351
procsrv::run("",
351-
gdb_path,
352+
gdb_path.as_slice(),
352353
debugger_opts.as_slice(),
353354
vec!((~"",~"")),
354355
None)

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,3 +496,16 @@ NUL-terminated string for interoperability with C, you should use the `c_str::to
496496

497497
The standard library includes type aliases and function definitions for the C standard library in
498498
the `libc` module, and Rust links against `libc` and `libm` by default.
499+
500+
# The "nullable pointer optimization"
501+
502+
Certain types are defined to not be `null`. This includes references (`&T`,
503+
`&mut T`), owning pointers (`~T`), and function pointers (`extern "abi"
504+
fn()`). When interfacing with C, pointers that might be null are often used.
505+
As a special case, a generic `enum` that contains exactly two variants, one of
506+
which contains no data and the other containing a single field, is eligible
507+
for the "nullable pointer optimization". When such an enum is instantiated
508+
with one of the non-nullable types, it is represented as a single pointer,
509+
and the non-data variant is represented as the null pointer. So
510+
`Option<extern "C" fn(c_int) -> c_int>` is how one represents a nullable
511+
function pointer using the C ABI.

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ runner.
170170

171171
The type signature of a benchmark function differs from a unit test:
172172
it takes a mutable reference to type
173-
`test::BenchHarness`. Inside the benchmark function, any
173+
`test::Bencher`. Inside the benchmark function, any
174174
time-variable or "setup" code should execute first, followed by a call
175175
to `iter` on the benchmark harness, passing a closure that contains
176176
the portion of the benchmark you wish to actually measure the
@@ -189,16 +189,16 @@ For example:
189189
extern crate test;
190190
191191
use std::slice;
192-
use test::BenchHarness;
192+
use test::Bencher;
193193
194194
#[bench]
195-
fn bench_sum_1024_ints(b: &mut BenchHarness) {
195+
fn bench_sum_1024_ints(b: &mut Bencher) {
196196
let v = slice::from_fn(1024, |n| n);
197197
b.iter(|| {v.iter().fold(0, |old, new| old + *new);} );
198198
}
199199
200200
#[bench]
201-
fn initialise_a_vector(b: &mut BenchHarness) {
201+
fn initialise_a_vector(b: &mut Bencher) {
202202
b.iter(|| {slice::from_elem(1024, 0u64);} );
203203
b.bytes = 1024 * 8;
204204
}
@@ -249,11 +249,11 @@ it entirely.
249249
~~~
250250
# #[allow(unused_imports)];
251251
extern crate test;
252-
use test::BenchHarness;
252+
use test::Bencher;
253253
254254
#[bench]
255-
fn bench_xor_1000_ints(bh: &mut BenchHarness) {
256-
bh.iter(|| {
255+
fn bench_xor_1000_ints(b: &mut Bencher) {
256+
b.iter(|| {
257257
range(0, 1000).fold(0, |old, new| old ^ new);
258258
});
259259
}

branches/try2/src/doc/tutorial.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1579,6 +1579,8 @@ allocated memory on the heap. A unique vector owns the elements it contains, so
15791579
the elements are mutable if the vector is mutable.
15801580
15811581
~~~
1582+
use std::strbuf::StrBuf;
1583+
15821584
// A dynamically sized vector (unique vector)
15831585
let mut numbers = ~[1, 2, 3];
15841586
numbers.push(4);
@@ -1589,7 +1591,7 @@ let more_numbers: ~[int] = numbers;
15891591

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

1592-
let mut string = ~"fo";
1594+
let mut string = StrBuf::from_str("fo");
15931595
string.push_char('o');
15941596
~~~
15951597

branches/try2/src/libarena/lib.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,7 @@ impl<T> Drop for TypedArena<T> {
481481
#[cfg(test)]
482482
mod tests {
483483
extern crate test;
484-
485-
486-
use self::test::BenchHarness;
484+
use self::test::Bencher;
487485
use super::{Arena, TypedArena};
488486

489487
struct Point {
@@ -505,9 +503,9 @@ mod tests {
505503
}
506504

507505
#[bench]
508-
pub fn bench_copy(bh: &mut BenchHarness) {
506+
pub fn bench_copy(b: &mut Bencher) {
509507
let arena = TypedArena::new();
510-
bh.iter(|| {
508+
b.iter(|| {
511509
arena.alloc(Point {
512510
x: 1,
513511
y: 2,
@@ -517,8 +515,8 @@ mod tests {
517515
}
518516

519517
#[bench]
520-
pub fn bench_copy_nonarena(bh: &mut BenchHarness) {
521-
bh.iter(|| {
518+
pub fn bench_copy_nonarena(b: &mut Bencher) {
519+
b.iter(|| {
522520
~Point {
523521
x: 1,
524522
y: 2,
@@ -528,9 +526,9 @@ mod tests {
528526
}
529527

530528
#[bench]
531-
pub fn bench_copy_old_arena(bh: &mut BenchHarness) {
529+
pub fn bench_copy_old_arena(b: &mut Bencher) {
532530
let arena = Arena::new();
533-
bh.iter(|| {
531+
b.iter(|| {
534532
arena.alloc(|| {
535533
Point {
536534
x: 1,
@@ -558,9 +556,9 @@ mod tests {
558556
}
559557

560558
#[bench]
561-
pub fn bench_noncopy(bh: &mut BenchHarness) {
559+
pub fn bench_noncopy(b: &mut Bencher) {
562560
let arena = TypedArena::new();
563-
bh.iter(|| {
561+
b.iter(|| {
564562
arena.alloc(Noncopy {
565563
string: ~"hello world",
566564
array: vec!( 1, 2, 3, 4, 5 ),
@@ -569,8 +567,8 @@ mod tests {
569567
}
570568

571569
#[bench]
572-
pub fn bench_noncopy_nonarena(bh: &mut BenchHarness) {
573-
bh.iter(|| {
570+
pub fn bench_noncopy_nonarena(b: &mut Bencher) {
571+
b.iter(|| {
574572
~Noncopy {
575573
string: ~"hello world",
576574
array: vec!( 1, 2, 3, 4, 5 ),
@@ -579,9 +577,9 @@ mod tests {
579577
}
580578

581579
#[bench]
582-
pub fn bench_noncopy_old_arena(bh: &mut BenchHarness) {
580+
pub fn bench_noncopy_old_arena(b: &mut Bencher) {
583581
let arena = Arena::new();
584-
bh.iter(|| {
582+
b.iter(|| {
585583
arena.alloc(|| Noncopy {
586584
string: ~"hello world",
587585
array: vec!( 1, 2, 3, 4, 5 ),

branches/try2/src/libcollections/bitv.rs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ use std::cmp;
1515
use std::iter::RandomAccessIterator;
1616
use std::iter::{Rev, Enumerate, Repeat, Map, Zip};
1717
use std::ops;
18-
use std::uint;
1918
use std::slice;
19+
use std::strbuf::StrBuf;
20+
use std::uint;
2021

2122
#[deriving(Clone)]
2223
struct SmallBitv {
@@ -499,15 +500,15 @@ impl Bitv {
499500
* character is either '0' or '1'.
500501
*/
501502
pub fn to_str(&self) -> ~str {
502-
let mut rs = ~"";
503+
let mut rs = StrBuf::new();
503504
for i in self.iter() {
504505
if i {
505506
rs.push_char('1');
506507
} else {
507508
rs.push_char('0');
508509
}
509510
};
510-
rs
511+
rs.into_owned()
511512
}
512513

513514

@@ -939,7 +940,7 @@ impl<'a> Iterator<uint> for BitPositions<'a> {
939940
#[cfg(test)]
940941
mod tests {
941942
extern crate test;
942-
use self::test::BenchHarness;
943+
use self::test::Bencher;
943944

944945
use bitv::{Bitv, SmallBitv, BigBitv, BitvSet, from_bools, from_fn,
945946
from_bytes};
@@ -1556,7 +1557,7 @@ mod tests {
15561557
}
15571558

15581559
#[bench]
1559-
fn bench_uint_small(b: &mut BenchHarness) {
1560+
fn bench_uint_small(b: &mut Bencher) {
15601561
let mut r = rng();
15611562
let mut bitv = 0 as uint;
15621563
b.iter(|| {
@@ -1566,7 +1567,7 @@ mod tests {
15661567
}
15671568

15681569
#[bench]
1569-
fn bench_small_bitv_small(b: &mut BenchHarness) {
1570+
fn bench_small_bitv_small(b: &mut Bencher) {
15701571
let mut r = rng();
15711572
let mut bitv = SmallBitv::new(uint::BITS);
15721573
b.iter(|| {
@@ -1576,7 +1577,7 @@ mod tests {
15761577
}
15771578

15781579
#[bench]
1579-
fn bench_big_bitv_small(b: &mut BenchHarness) {
1580+
fn bench_big_bitv_small(b: &mut Bencher) {
15801581
let mut r = rng();
15811582
let mut bitv = BigBitv::new(vec!(0));
15821583
b.iter(|| {
@@ -1586,7 +1587,7 @@ mod tests {
15861587
}
15871588

15881589
#[bench]
1589-
fn bench_big_bitv_big(b: &mut BenchHarness) {
1590+
fn bench_big_bitv_big(b: &mut Bencher) {
15901591
let mut r = rng();
15911592
let mut storage = vec!();
15921593
storage.grow(BENCH_BITS / uint::BITS, &0u);
@@ -1598,7 +1599,7 @@ mod tests {
15981599
}
15991600

16001601
#[bench]
1601-
fn bench_bitv_big(b: &mut BenchHarness) {
1602+
fn bench_bitv_big(b: &mut Bencher) {
16021603
let mut r = rng();
16031604
let mut bitv = Bitv::new(BENCH_BITS, false);
16041605
b.iter(|| {
@@ -1608,7 +1609,7 @@ mod tests {
16081609
}
16091610

16101611
#[bench]
1611-
fn bench_bitv_small(b: &mut BenchHarness) {
1612+
fn bench_bitv_small(b: &mut Bencher) {
16121613
let mut r = rng();
16131614
let mut bitv = Bitv::new(uint::BITS, false);
16141615
b.iter(|| {
@@ -1618,7 +1619,7 @@ mod tests {
16181619
}
16191620

16201621
#[bench]
1621-
fn bench_bitv_set_small(b: &mut BenchHarness) {
1622+
fn bench_bitv_set_small(b: &mut Bencher) {
16221623
let mut r = rng();
16231624
let mut bitv = BitvSet::new();
16241625
b.iter(|| {
@@ -1628,7 +1629,7 @@ mod tests {
16281629
}
16291630

16301631
#[bench]
1631-
fn bench_bitv_set_big(b: &mut BenchHarness) {
1632+
fn bench_bitv_set_big(b: &mut Bencher) {
16321633
let mut r = rng();
16331634
let mut bitv = BitvSet::new();
16341635
b.iter(|| {
@@ -1638,7 +1639,7 @@ mod tests {
16381639
}
16391640

16401641
#[bench]
1641-
fn bench_bitv_big_union(b: &mut BenchHarness) {
1642+
fn bench_bitv_big_union(b: &mut Bencher) {
16421643
let mut b1 = Bitv::new(BENCH_BITS, false);
16431644
let b2 = Bitv::new(BENCH_BITS, false);
16441645
b.iter(|| {
@@ -1647,7 +1648,7 @@ mod tests {
16471648
}
16481649

16491650
#[bench]
1650-
fn bench_btv_small_iter(b: &mut BenchHarness) {
1651+
fn bench_btv_small_iter(b: &mut Bencher) {
16511652
let bitv = Bitv::new(uint::BITS, false);
16521653
b.iter(|| {
16531654
let mut _sum = 0;
@@ -1658,7 +1659,7 @@ mod tests {
16581659
}
16591660

16601661
#[bench]
1661-
fn bench_bitv_big_iter(b: &mut BenchHarness) {
1662+
fn bench_bitv_big_iter(b: &mut Bencher) {
16621663
let bitv = Bitv::new(BENCH_BITS, false);
16631664
b.iter(|| {
16641665
let mut _sum = 0;
@@ -1669,7 +1670,7 @@ mod tests {
16691670
}
16701671

16711672
#[bench]
1672-
fn bench_bitvset_iter(b: &mut BenchHarness) {
1673+
fn bench_bitvset_iter(b: &mut Bencher) {
16731674
let bitv = BitvSet::from_bitv(from_fn(BENCH_BITS,
16741675
|idx| {idx % 3 == 0}));
16751676
b.iter(|| {

0 commit comments

Comments
 (0)