Skip to content

Commit e1f0ef3

Browse files
committed
---
yaml --- r: 104959 b: refs/heads/snap-stage3 c: aa5c8ea h: refs/heads/master i: 104957: 0598d2f 104955: 9dad564 104951: 9b5d786 104943: 6d04097 104927: 1274270 104895: 6465695 104831: bb6b999 104703: 6d74d86 104447: cbf0a6d v: v3
1 parent 5f05519 commit e1f0ef3

File tree

135 files changed

+458
-488
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

+458
-488
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 62f1d68439dcfd509eaca29887afa97f22938373
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 7aded2adb6782d8188a631250ab8d72c82bd070c
4+
refs/heads/snap-stage3: aa5c8ea600f38729b8fcb29494295abfa1065842
55
refs/heads/try: db814977d07bd798feb24f6b74c00800ef458a13
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/compiletest/runtest.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use std::io;
3232
use std::os;
3333
use std::str;
3434
use std::task;
35-
use std::slice;
35+
use std::vec;
3636

3737
use test::MetricMap;
3838

@@ -500,7 +500,7 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
500500
proc_res: &ProcRes) {
501501

502502
// true if we found the error in question
503-
let mut found_flags = slice::from_elem(
503+
let mut found_flags = vec::from_elem(
504504
expected_errors.len(), false);
505505

506506
if proc_res.status.success() {

branches/snap-stage3/src/doc/guide-ffi.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ The raw C API needs to be wrapped to provide memory safety and make use of highe
7171
like vectors. A library can choose to expose only the safe, high-level interface and hide the unsafe
7272
internal details.
7373

74-
Wrapping the functions which expect buffers involves using the `slice::raw` module to manipulate Rust
74+
Wrapping the functions which expect buffers involves using the `vec::raw` module to manipulate Rust
7575
vectors as pointers to memory. Rust's vectors are guaranteed to be a contiguous block of memory. The
7676
length is number of elements currently contained, and the capacity is the total size in elements of
7777
the allocated memory. The length is less than or equal to the capacity.
@@ -103,7 +103,7 @@ pub fn compress(src: &[u8]) -> ~[u8] {
103103
let psrc = src.as_ptr();
104104
105105
let mut dstlen = snappy_max_compressed_length(srclen);
106-
let mut dst = slice::with_capacity(dstlen as uint);
106+
let mut dst = vec::with_capacity(dstlen as uint);
107107
let pdst = dst.as_mut_ptr();
108108
109109
snappy_compress(psrc, srclen, pdst, &mut dstlen);
@@ -125,7 +125,7 @@ pub fn uncompress(src: &[u8]) -> Option<~[u8]> {
125125
let mut dstlen: size_t = 0;
126126
snappy_uncompressed_length(psrc, srclen, &mut dstlen);
127127
128-
let mut dst = slice::with_capacity(dstlen as uint);
128+
let mut dst = vec::with_capacity(dstlen as uint);
129129
let pdst = dst.as_mut_ptr();
130130
131131
if snappy_uncompress(psrc, srclen, pdst, &mut dstlen) == 0 {

branches/snap-stage3/src/doc/guide-tasks.md

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

256256
~~~
257257
# use std::task::spawn;
258-
# use std::slice;
258+
# use std::vec;
259259
260260
// Create a vector of ports, one for each child task
261-
let rxs = slice::from_fn(3, |init_val| {
261+
let rxs = vec::from_fn(3, |init_val| {
262262
let (tx, rx) = channel();
263263
spawn(proc() {
264264
tx.send(some_expensive_computation(init_val));
@@ -304,7 +304,7 @@ be distributed on the available cores.
304304

305305
~~~
306306
# extern crate sync;
307-
# use std::slice;
307+
# use std::vec;
308308
fn partial_sum(start: uint) -> f64 {
309309
let mut local_sum = 0f64;
310310
for num in range(start*100000, (start+1)*100000) {
@@ -314,7 +314,7 @@ fn partial_sum(start: uint) -> f64 {
314314
}
315315
316316
fn main() {
317-
let mut futures = slice::from_fn(1000, |ind| sync::Future::spawn( proc() { partial_sum(ind) }));
317+
let mut futures = vec::from_fn(1000, |ind| sync::Future::spawn( proc() { partial_sum(ind) }));
318318
319319
let mut final_res = 0f64;
320320
for ft in futures.mut_iter() {
@@ -342,15 +342,15 @@ a single large vector of floats. Each task needs the full vector to perform its
342342
extern crate rand;
343343
extern crate sync;
344344
345-
use std::slice;
345+
use std::vec;
346346
use sync::Arc;
347347
348348
fn pnorm(nums: &~[f64], p: uint) -> f64 {
349349
nums.iter().fold(0.0, |a,b| a+(*b).powf(&(p as f64)) ).powf(&(1.0 / (p as f64)))
350350
}
351351
352352
fn main() {
353-
let numbers = slice::from_fn(1000000, |_| rand::random::<f64>());
353+
let numbers = vec::from_fn(1000000, |_| rand::random::<f64>());
354354
let numbers_arc = Arc::new(numbers);
355355
356356
for num in range(1u, 10) {
@@ -374,9 +374,9 @@ created by the line
374374
# extern crate sync;
375375
# extern crate rand;
376376
# use sync::Arc;
377-
# use std::slice;
377+
# use std::vec;
378378
# fn main() {
379-
# let numbers = slice::from_fn(1000000, |_| rand::random::<f64>());
379+
# let numbers = vec::from_fn(1000000, |_| rand::random::<f64>());
380380
let numbers_arc=Arc::new(numbers);
381381
# }
382382
~~~
@@ -387,9 +387,9 @@ and a clone of it is sent to each task
387387
# extern crate sync;
388388
# extern crate rand;
389389
# use sync::Arc;
390-
# use std::slice;
390+
# use std::vec;
391391
# fn main() {
392-
# let numbers=slice::from_fn(1000000, |_| rand::random::<f64>());
392+
# let numbers=vec::from_fn(1000000, |_| rand::random::<f64>());
393393
# let numbers_arc = Arc::new(numbers);
394394
# let (tx, rx) = channel();
395395
tx.send(numbers_arc.clone());
@@ -404,9 +404,9 @@ Each task recovers the underlying data by
404404
# extern crate sync;
405405
# extern crate rand;
406406
# use sync::Arc;
407-
# use std::slice;
407+
# use std::vec;
408408
# fn main() {
409-
# let numbers=slice::from_fn(1000000, |_| rand::random::<f64>());
409+
# let numbers=vec::from_fn(1000000, |_| rand::random::<f64>());
410410
# let numbers_arc=Arc::new(numbers);
411411
# let (tx, rx) = channel();
412412
# tx.send(numbers_arc.clone());

branches/snap-stage3/src/doc/guide-testing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,18 +188,18 @@ For example:
188188
# #[allow(unused_imports)];
189189
extern crate test;
190190
191-
use std::slice;
191+
use std::vec;
192192
use test::BenchHarness;
193193
194194
#[bench]
195195
fn bench_sum_1024_ints(b: &mut BenchHarness) {
196-
let v = slice::from_fn(1024, |n| n);
196+
let v = vec::from_fn(1024, |n| n);
197197
b.iter(|| {v.iter().fold(0, |old, new| old + *new);} );
198198
}
199199
200200
#[bench]
201201
fn initialise_a_vector(b: &mut BenchHarness) {
202-
b.iter(|| {slice::from_elem(1024, 0u64);} );
202+
b.iter(|| {vec::from_elem(1024, 0u64);} );
203203
b.bytes = 1024 * 8;
204204
}
205205

branches/snap-stage3/src/etc/unicode.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def emit_bsearch_range_table(f):
162162
f.write("""
163163
fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
164164
use cmp::{Equal, Less, Greater};
165-
use slice::ImmutableVector;
165+
use vec::ImmutableVector;
166166
use option::None;
167167
r.bsearch(|&(lo,hi)| {
168168
if lo <= c && c <= hi { Equal }
@@ -200,7 +200,7 @@ def emit_conversions_module(f, lowerupper, upperlower):
200200
f.write("pub mod conversions {\n")
201201
f.write("""
202202
use cmp::{Equal, Less, Greater};
203-
use slice::ImmutableVector;
203+
use vec::ImmutableVector;
204204
use tuple::Tuple2;
205205
use option::{Option, Some, None};
206206
@@ -264,7 +264,7 @@ def emit_decomp_module(f, canon, compat, combine):
264264
f.write("pub mod decompose {\n");
265265
f.write(" use option::Option;\n");
266266
f.write(" use option::{Some, None};\n");
267-
f.write(" use slice::ImmutableVector;\n");
267+
f.write(" use vec::ImmutableVector;\n");
268268
f.write("""
269269
fn bsearch_table(c: char, r: &'static [(char, &'static [char])]) -> Option<&'static [char]> {
270270
use cmp::{Equal, Less, Greater};

branches/snap-stage3/src/libarena/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use std::rc::Rc;
4242
use std::rt::global_heap;
4343
use std::intrinsics::{TyDesc, get_tydesc};
4444
use std::intrinsics;
45-
use std::slice;
45+
use std::vec;
4646

4747
// The way arena uses arrays is really deeply awful. The arrays are
4848
// allocated, and have capacities reserved, but the fill for the array
@@ -111,7 +111,7 @@ impl Arena {
111111

112112
fn chunk(size: uint, is_pod: bool) -> Chunk {
113113
Chunk {
114-
data: Rc::new(RefCell::new(slice::with_capacity(size))),
114+
data: Rc::new(RefCell::new(vec::with_capacity(size))),
115115
fill: Cell::new(0u),
116116
is_pod: Cell::new(is_pod),
117117
}

branches/snap-stage3/src/libcollections/bitv.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::iter::RandomAccessIterator;
1616
use std::iter::{Rev, Enumerate, Repeat, Map, Zip};
1717
use std::ops;
1818
use std::uint;
19-
use std::slice;
19+
use std::vec;
2020

2121
#[deriving(Clone)]
2222
struct SmallBitv {
@@ -278,13 +278,13 @@ impl Bitv {
278278
let s =
279279
if init {
280280
if exact {
281-
slice::from_elem(nelems, !0u)
281+
vec::from_elem(nelems, !0u)
282282
} else {
283-
let mut v = slice::from_elem(nelems-1, !0u);
283+
let mut v = vec::from_elem(nelems-1, !0u);
284284
v.push((1<<nbits % uint::BITS)-1);
285285
v
286286
}
287-
} else { slice::from_elem(nelems, 0u)};
287+
} else { vec::from_elem(nelems, 0u)};
288288
Big(BigBitv::new(s))
289289
};
290290
Bitv {rep: rep, nbits: nbits}
@@ -452,7 +452,7 @@ impl Bitv {
452452
* Each `uint` in the resulting vector has either value `0u` or `1u`.
453453
*/
454454
pub fn to_vec(&self) -> ~[uint] {
455-
slice::from_fn(self.nbits, |x| self.init_to_vec(x))
455+
vec::from_fn(self.nbits, |x| self.init_to_vec(x))
456456
}
457457

458458
/**
@@ -473,7 +473,7 @@ impl Bitv {
473473

474474
let len = self.nbits/8 +
475475
if self.nbits % 8 == 0 { 0 } else { 1 };
476-
slice::from_fn(len, |i|
476+
vec::from_fn(len, |i|
477477
bit(self, i, 0) |
478478
bit(self, i, 1) |
479479
bit(self, i, 2) |
@@ -489,7 +489,7 @@ impl Bitv {
489489
* Transform `self` into a `[bool]` by turning each bit into a `bool`.
490490
*/
491491
pub fn to_bools(&self) -> ~[bool] {
492-
slice::from_fn(self.nbits, |i| self[i])
492+
vec::from_fn(self.nbits, |i| self[i])
493493
}
494494

495495
/**
@@ -879,7 +879,7 @@ impl BitvSet {
879879
/// and w1/w2 are the words coming from the two vectors self, other.
880880
fn commons<'a>(&'a self, other: &'a BitvSet)
881881
-> Map<'static, ((uint, &'a uint), &'a ~[uint]), (uint, uint, uint),
882-
Zip<Enumerate<slice::Items<'a, uint>>, Repeat<&'a ~[uint]>>> {
882+
Zip<Enumerate<vec::Items<'a, uint>>, Repeat<&'a ~[uint]>>> {
883883
let min = cmp::min(self.bitv.storage.len(), other.bitv.storage.len());
884884
self.bitv.storage.slice(0, min).iter().enumerate()
885885
.zip(Repeat::new(&other.bitv.storage))
@@ -895,7 +895,7 @@ impl BitvSet {
895895
/// `other`.
896896
fn outliers<'a>(&'a self, other: &'a BitvSet)
897897
-> Map<'static, ((uint, &'a uint), uint), (bool, uint, uint),
898-
Zip<Enumerate<slice::Items<'a, uint>>, Repeat<uint>>> {
898+
Zip<Enumerate<vec::Items<'a, uint>>, Repeat<uint>>> {
899899
let slen = self.bitv.storage.len();
900900
let olen = other.bitv.storage.len();
901901

@@ -946,7 +946,7 @@ mod tests {
946946
use bitv;
947947

948948
use std::uint;
949-
use std::slice;
949+
use std::vec;
950950
use rand;
951951
use rand::Rng;
952952

@@ -964,7 +964,7 @@ mod tests {
964964
#[test]
965965
fn test_0_elements() {
966966
let act = Bitv::new(0u, false);
967-
let exp = slice::from_elem::<bool>(0u, false);
967+
let exp = vec::from_elem::<bool>(0u, false);
968968
assert!(act.eq_vec(exp));
969969
}
970970

branches/snap-stage3/src/libcollections/deque.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub mod bench {
4444
extern crate test;
4545
use self::test::BenchHarness;
4646
use std::container::MutableMap;
47-
use std::slice;
47+
use std::vec;
4848
use rand;
4949
use rand::Rng;
5050

@@ -90,7 +90,7 @@ pub mod bench {
9090
bh: &mut BenchHarness) {
9191
// setup
9292
let mut rng = rand::XorShiftRng::new();
93-
let mut keys = slice::from_fn(n, |_| rng.gen::<uint>() % n);
93+
let mut keys = vec::from_fn(n, |_| rng.gen::<uint>() % n);
9494

9595
for k in keys.iter() {
9696
map.insert(*k, 1);

branches/snap-stage3/src/libcollections/hashmap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use std::option::{Option, Some, None};
2727
use rand;
2828
use rand::Rng;
2929
use std::result::{Ok, Err};
30-
use std::slice::ImmutableVector;
30+
use std::vec::{ImmutableVector};
3131

3232
mod table {
3333
use std::clone::Clone;
@@ -1958,7 +1958,7 @@ mod test_map {
19581958
mod test_set {
19591959
use super::HashSet;
19601960
use std::container::Container;
1961-
use std::slice::ImmutableEqVector;
1961+
use std::vec::ImmutableEqVector;
19621962

19631963
#[test]
19641964
fn test_disjoint() {

branches/snap-stage3/src/libcollections/priority_queue.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
use std::clone::Clone;
1616
use std::mem::{move_val_init, init, replace, swap};
17-
use std::slice;
17+
use std::vec;
1818

1919
/// A priority queue implemented with a binary heap
2020
#[deriving(Clone)]
@@ -181,7 +181,7 @@ impl<T:Ord> PriorityQueue<T> {
181181

182182
/// PriorityQueue iterator
183183
pub struct Items <'a, T> {
184-
priv iter: slice::Items<'a, T>,
184+
priv iter: vec::Items<'a, T>,
185185
}
186186

187187
impl<'a, T> Iterator<&'a T> for Items<'a, T> {

branches/snap-stage3/src/libcollections/ringbuf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//! extra::container::Deque`.
1515
1616
use std::cmp;
17-
use std::slice;
17+
use std::vec;
1818
use std::iter::{Rev, RandomAccessIterator};
1919

2020
use deque::Deque;
@@ -118,7 +118,7 @@ impl<T> RingBuf<T> {
118118
/// Create an empty RingBuf with space for at least `n` elements.
119119
pub fn with_capacity(n: uint) -> RingBuf<T> {
120120
RingBuf{nelts: 0, lo: 0,
121-
elts: slice::from_fn(cmp::max(MINIMUM_CAPACITY, n), |_| None)}
121+
elts: vec::from_fn(cmp::max(MINIMUM_CAPACITY, n), |_| None)}
122122
}
123123

124124
/// Retrieve an element in the RingBuf by index

0 commit comments

Comments
 (0)