Skip to content

Commit 797f865

Browse files
committed
---
yaml --- r: 30753 b: refs/heads/incoming c: fe09451 h: refs/heads/master i: 30751: c7a8bd1 v: v3
1 parent a2eca5f commit 797f865

File tree

3 files changed

+17
-21
lines changed

3 files changed

+17
-21
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: 3023bd872949ce4ba45e13dbcd30d6b98963d0ed
9+
refs/heads/incoming: fe09451a5a34931e11fa67ee83ac8deaa8d585be
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/libcore/at_vec.rs

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
//! Managed vectors
22
3-
// NB: transitionary, de-mode-ing.
4-
#[forbid(deprecated_mode)];
5-
#[forbid(deprecated_pattern)];
6-
73
use ptr::addr_of;
84

95
/// Code for dealing with @-vectors. This is pretty incomplete, and
@@ -25,7 +21,7 @@ extern mod rusti {
2521

2622
/// Returns the number of elements the vector can hold without reallocating
2723
#[inline(always)]
28-
pub pure fn capacity<T>(v: @[const T]) -> uint {
24+
pub pure fn capacity<T>(&&v: @[const T]) -> uint {
2925
unsafe {
3026
let repr: **raw::VecRepr =
3127
::cast::reinterpret_cast(&addr_of(v));
@@ -47,7 +43,7 @@ pub pure fn capacity<T>(v: @[const T]) -> uint {
4743
*/
4844
#[inline(always)]
4945
pub pure fn build_sized<A>(size: uint,
50-
builder: &fn(push: pure fn(+v: A))) -> @[A] {
46+
builder: fn(push: pure fn(+v: A))) -> @[A] {
5147
let mut vec = @[];
5248
unsafe { raw::reserve(vec, size); }
5349
builder(|+x| unsafe { raw::push(vec, move x) });
@@ -65,7 +61,7 @@ pub pure fn build_sized<A>(size: uint,
6561
* onto the vector being constructed.
6662
*/
6763
#[inline(always)]
68-
pub pure fn build<A>(builder: &fn(push: pure fn(+v: A))) -> @[A] {
64+
pub pure fn build<A>(builder: fn(push: pure fn(+v: A))) -> @[A] {
6965
build_sized(4, builder)
7066
}
7167

@@ -82,8 +78,8 @@ pub pure fn build<A>(builder: &fn(push: pure fn(+v: A))) -> @[A] {
8278
* onto the vector being constructed.
8379
*/
8480
#[inline(always)]
85-
pub pure fn build_sized_opt<A>(+size: Option<uint>,
86-
builder: &fn(push: pure fn(+v: A))) -> @[A] {
81+
pub pure fn build_sized_opt<A>(size: Option<uint>,
82+
builder: fn(push: pure fn(+v: A))) -> @[A] {
8783
build_sized(size.get_default(4), builder)
8884
}
8985

@@ -98,10 +94,10 @@ pub pure fn append<T: Copy>(lhs: @[T], rhs: &[const T]) -> @[T] {
9894

9995

10096
/// Apply a function to each element of a vector and return the results
101-
pub pure fn map<T, U>(v: &[T], f: &fn(x: &T) -> U) -> @[U] {
97+
pub pure fn map<T, U>(v: &[T], f: fn(T) -> U) -> @[U] {
10298
do build_sized(v.len()) |push| {
10399
for vec::each(v) |elem| {
104-
push(f(elem));
100+
push(f(*elem));
105101
}
106102
}
107103
}
@@ -125,10 +121,10 @@ pub pure fn from_fn<T>(n_elts: uint, op: iter::InitOp<T>) -> @[T] {
125121
* Creates an immutable vector of size `n_elts` and initializes the elements
126122
* to the value `t`.
127123
*/
128-
pub pure fn from_elem<T: Copy>(n_elts: uint, t: &T) -> @[T] {
124+
pub pure fn from_elem<T: Copy>(n_elts: uint, t: T) -> @[T] {
129125
do build_sized(n_elts) |push| {
130126
let mut i: uint = 0u;
131-
while i < n_elts { push(copy *t); i += 1u; }
127+
while i < n_elts { push(t); i += 1u; }
132128
}
133129
}
134130

@@ -159,13 +155,13 @@ pub mod raw {
159155
* the vector is actually the specified size.
160156
*/
161157
#[inline(always)]
162-
pub unsafe fn set_len<T>(v: @[const T], new_len: uint) {
158+
pub unsafe fn set_len<T>(&&v: @[const T], new_len: uint) {
163159
let repr: **VecRepr = ::cast::reinterpret_cast(&addr_of(v));
164160
(**repr).unboxed.fill = new_len * sys::size_of::<T>();
165161
}
166162

167163
#[inline(always)]
168-
pub unsafe fn push<T>(v: @[const T], +initval: T) {
164+
pub unsafe fn push<T>(&v: @[const T], +initval: T) {
169165
let repr: **VecRepr = ::cast::reinterpret_cast(&addr_of(v));
170166
let fill = (**repr).unboxed.fill;
171167
if (**repr).unboxed.alloc > fill {
@@ -177,7 +173,7 @@ pub mod raw {
177173
}
178174
// This doesn't bother to make sure we have space.
179175
#[inline(always)] // really pretty please
180-
pub unsafe fn push_fast<T>(v: @[const T], +initval: T) {
176+
pub unsafe fn push_fast<T>(&v: @[const T], +initval: T) {
181177
let repr: **VecRepr = ::cast::reinterpret_cast(&addr_of(v));
182178
let fill = (**repr).unboxed.fill;
183179
(**repr).unboxed.fill += sys::size_of::<T>();
@@ -186,7 +182,7 @@ pub mod raw {
186182
rusti::move_val_init(*p, move initval);
187183
}
188184

189-
pub unsafe fn push_slow<T>(v: @[const T], +initval: T) {
185+
pub unsafe fn push_slow<T>(&v: @[const T], +initval: T) {
190186
reserve_at_least(v, v.len() + 1u);
191187
push_fast(v, move initval);
192188
}
@@ -202,7 +198,7 @@ pub mod raw {
202198
* * v - A vector
203199
* * n - The number of elements to reserve space for
204200
*/
205-
pub unsafe fn reserve<T>(v: @[const T], n: uint) {
201+
pub unsafe fn reserve<T>(&v: @[const T], n: uint) {
206202
// Only make the (slow) call into the runtime if we have to
207203
if capacity(v) < n {
208204
let ptr = addr_of(v) as **VecRepr;
@@ -226,7 +222,7 @@ pub mod raw {
226222
* * v - A vector
227223
* * n - The number of elements to reserve space for
228224
*/
229-
pub unsafe fn reserve_at_least<T>(v: @[const T], n: uint) {
225+
pub unsafe fn reserve_at_least<T>(&v: @[const T], n: uint) {
230226
reserve(v, uint::next_power_of_two(n));
231227
}
232228

branches/incoming/src/libcore/iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The iteration traits and common implementation
77
use cmp::{Eq, Ord};
88

99
/// A function used to initialize the elements of a sequence
10-
type InitOp<T> = &fn(uint) -> T;
10+
type InitOp<T> = fn(uint) -> T;
1111

1212
trait BaseIter<A> {
1313
pure fn each(blk: fn(v: &A) -> bool);

0 commit comments

Comments
 (0)