Skip to content

Commit ee8fb37

Browse files
committed
---
yaml --- r: 30825 b: refs/heads/incoming c: 52ad275 h: refs/heads/master i: 30823: cad8e20 v: v3
1 parent aaea50f commit ee8fb37

Some content is hidden

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

41 files changed

+144
-244
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: ca4455666eaf09debf6fe769ba75f90453832981
9+
refs/heads/incoming: 52ad2750ea8c5f43bdb1bce009590df7fdc34461
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/doc/tutorial.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ literals and most enum variants.
616616

617617
`while` produces a loop that runs as long as its given condition
618618
(which must have type `bool`) evaluates to true. Inside a loop, the
619-
keyword `break` can be used to abort the loop, and `again` can be used
619+
keyword `break` can be used to abort the loop, and `loop` can be used
620620
to abort the current iteration and continue with the next.
621621

622622
~~~~
@@ -1564,7 +1564,7 @@ Empty argument lists can be omitted from `do` expressions.
15641564
15651565
Most iteration in Rust is done with `for` loops. Like `do`,
15661566
`for` is a nice syntax for doing control flow with closures.
1567-
Additionally, within a `for` loop, `break`, `again`, and `return`
1567+
Additionally, within a `for` loop, `break`, `loop`, and `return`
15681568
work just as they do with `while` and `loop`.
15691569
15701570
Consider again our `each` function, this time improved to
@@ -1599,7 +1599,7 @@ With `for`, functions like `each` can be treated more
15991599
like builtin looping structures. When calling `each`
16001600
in a `for` loop, instead of returning `false` to break
16011601
out of the loop, you just write `break`. To skip ahead
1602-
to the next iteration, write `again`.
1602+
to the next iteration, write `loop`.
16031603
16041604
~~~~
16051605
# use each = vec::each;

branches/incoming/src/compiletest/compiletest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn parse_config(args: ~[~str]) -> config {
5858
} else { option::None },
5959
logfile: option::map(&getopts::opt_maybe_str(matches,
6060
~"logfile"),
61-
|s| Path(s)),
61+
|s| Path(*s)),
6262
runtool: getopts::opt_maybe_str(matches, ~"runtool"),
6363
rustcflags: getopts::opt_maybe_str(matches, ~"rustcflags"),
6464
jit: getopts::opt_present(matches, ~"jit"),

branches/incoming/src/compiletest/header.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ fn parse_compile_flags(line: ~str) -> Option<~str> {
103103
fn parse_exec_env(line: ~str) -> Option<(~str, ~str)> {
104104
do parse_name_value_directive(line, ~"exec-env").map |nv| {
105105
// nv is either FOO or FOO=BAR
106-
let strs = str::splitn_char(nv, '=', 1u);
106+
let strs = str::splitn_char(*nv, '=', 1u);
107107
match strs.len() {
108108
1u => (strs[0], ~""),
109109
2u => (strs[0], strs[1]),

branches/incoming/src/libcore/dlist.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,13 +275,13 @@ impl<T> DList<T> {
275275
/// Remove a node from the head of the list. O(1).
276276
fn pop_n() -> Option<DListNode<T>> {
277277
let hd = self.peek_n();
278-
hd.map(|nobe| self.unlink(nobe));
278+
hd.map(|nobe| self.unlink(*nobe));
279279
hd
280280
}
281281
/// Remove a node from the tail of the list. O(1).
282282
fn pop_tail_n() -> Option<DListNode<T>> {
283283
let tl = self.peek_tail_n();
284-
tl.map(|nobe| self.unlink(nobe));
284+
tl.map(|nobe| self.unlink(*nobe));
285285
tl
286286
}
287287
/// Get the node at the list's head. O(1).

branches/incoming/src/libcore/io.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,8 +697,10 @@ impl BytesWriter: Writer {
697697
vec::reserve(&mut buf, count);
698698
unsafe { vec::raw::set_len(buf, count); }
699699
700-
let view = vec::mut_view(buf, self.pos, count);
701-
vec::bytes::memcpy(view, v, v_len);
700+
{
701+
let view = vec::mut_view(buf, self.pos, count);
702+
vec::bytes::memcpy(view, v, v_len);
703+
}
702704
703705
self.pos += v_len;
704706

branches/incoming/src/libcore/iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ pure fn from_elem<T: Copy,BT: Buildable<T>>(n_elts: uint, t: T) -> BT {
290290
pure fn append<T: Copy,IT: BaseIter<T>,BT: Buildable<T>>(
291291
lhs: IT, rhs: IT) -> BT {
292292
let size_opt = lhs.size_hint().chain(
293-
|sz1| rhs.size_hint().map(|sz2| sz1+sz2));
293+
|sz1| rhs.size_hint().map(|sz2| sz1+*sz2));
294294
do build_sized_opt(size_opt) |push| {
295295
for lhs.each |x| { push(*x); }
296296
for rhs.each |x| { push(*x); }

branches/incoming/src/libcore/option.rs

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,7 @@ pure fn expect<T: Copy>(opt: &Option<T>, +reason: ~str) -> T {
6161
match *opt { Some(x) => x, None => fail reason }
6262
}
6363

64-
pure fn map<T, U>(opt: &Option<T>, f: fn(T) -> U) -> Option<U> {
65-
//! Maps a `some` value from one type to another
66-
67-
match *opt { Some(x) => Some(f(x)), None => None }
68-
}
69-
70-
pure fn map_ref<T, U>(opt: &Option<T>, f: fn(x: &T) -> U) -> Option<U> {
64+
pure fn map<T, U>(opt: &Option<T>, f: fn(x: &T) -> U) -> Option<U> {
7165
//! Maps a `some` value by reference from one type to another
7266
7367
match *opt { Some(ref x) => Some(f(x)), None => None }
@@ -138,14 +132,7 @@ pure fn get_default<T: Copy>(opt: &Option<T>, +def: T) -> T {
138132
match *opt { Some(x) => x, None => def }
139133
}
140134

141-
pure fn map_default<T, U>(opt: &Option<T>, +def: U, f: fn(T) -> U) -> U {
142-
//! Applies a function to the contained value or returns a default
143-
144-
match *opt { None => move def, Some(t) => f(t) }
145-
}
146-
147-
// This should replace map_default.
148-
pure fn map_default_ref<T, U>(opt: &Option<T>, +def: U,
135+
pure fn map_default<T, U>(opt: &Option<T>, +def: U,
149136
f: fn(x: &T) -> U) -> U {
150137
//! Applies a function to the contained value or returns a default
151138
@@ -200,17 +187,12 @@ impl<T> Option<T> {
200187
* function that returns an option.
201188
*/
202189
pure fn chain<U>(f: fn(T) -> Option<U>) -> Option<U> { chain(&self, f) }
203-
/// Applies a function to the contained value or returns a default
204-
pure fn map_default<U>(+def: U, f: fn(T) -> U) -> U
205-
{ map_default(&self, move def, f) }
206190
/// Performs an operation on the contained value or does nothing
207191
pure fn iter(f: fn(T)) { iter(&self, f) }
208192
/// Returns true if the option equals `none`
209193
pure fn is_none() -> bool { is_none(&self) }
210194
/// Returns true if the option contains some value
211195
pure fn is_some() -> bool { is_some(&self) }
212-
/// Maps a `some` value from one type to another
213-
pure fn map<U>(f: fn(T) -> U) -> Option<U> { map(&self, f) }
214196
}
215197

216198
impl<T> &Option<T> {
@@ -222,12 +204,12 @@ impl<T> &Option<T> {
222204
chain_ref(self, f)
223205
}
224206
/// Applies a function to the contained value or returns a default
225-
pure fn map_default_ref<U>(+def: U, f: fn(x: &T) -> U) -> U
226-
{ map_default_ref(self, move def, f) }
207+
pure fn map_default<U>(+def: U, f: fn(x: &T) -> U) -> U
208+
{ map_default(self, move def, f) }
227209
/// Performs an operation on the contained value by reference
228210
pure fn iter_ref(f: fn(x: &T)) { iter_ref(self, f) }
229211
/// Maps a `some` value from one type to another by reference
230-
pure fn map_ref<U>(f: fn(x: &T) -> U) -> Option<U> { map_ref(self, f) }
212+
pure fn map<U>(f: fn(x: &T) -> U) -> Option<U> { map(self, f) }
231213
/// Gets an immutable reference to the value inside a `some`.
232214
pure fn get_ref() -> &self/T { get_ref(self) }
233215
}

branches/incoming/src/libcore/os.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ fn self_exe_path() -> Option<Path> {
439439
}
440440

441441
do load_self().map |pth| {
442-
Path(pth).dir_path()
442+
Path(*pth).dir_path()
443443
}
444444
}
445445

branches/incoming/src/libcore/pipes.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -236,21 +236,6 @@ pub fn entangle_buffer<T: Send, Tstart: Send>(
236236
(SendPacketBuffered(p), RecvPacketBuffered(p))
237237
}
238238

239-
#[cfg(stage0)]
240-
#[abi = "rust-intrinsic"]
241-
#[doc(hidden)]
242-
extern mod rusti {
243-
#[legacy_exports];
244-
fn atomic_xchg(dst: &mut int, ++src: int) -> int;
245-
fn atomic_xchg_acq(dst: &mut int, ++src: int) -> int;
246-
fn atomic_xchg_rel(dst: &mut int, ++src: int) -> int;
247-
248-
fn atomic_xadd_acq(dst: &mut int, ++src: int) -> int;
249-
fn atomic_xsub_rel(dst: &mut int, ++src: int) -> int;
250-
}
251-
252-
#[cfg(stage1)]
253-
#[cfg(stage2)]
254239
#[abi = "rust-intrinsic"]
255240
#[doc(hidden)]
256241
extern mod rusti {

branches/incoming/src/libcore/str.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,10 +1827,10 @@ const tag_six_b: uint = 252u;
18271827
* let i = str::as_bytes("Hello World") { |bytes| vec::len(bytes) };
18281828
* ~~~
18291829
*/
1830-
pure fn as_bytes<T>(s: &const ~str, f: fn(~[u8]) -> T) -> T {
1830+
pure fn as_bytes<T>(s: &const ~str, f: fn((&~[u8])) -> T) -> T {
18311831
unsafe {
18321832
let v: *~[u8] = cast::transmute(copy s);
1833-
f(*v)
1833+
f(&*v)
18341834
}
18351835
}
18361836

@@ -1945,7 +1945,7 @@ fn reserve_at_least(s: &const ~str, n: uint) {
19451945
*/
19461946
pure fn capacity(s: &const ~str) -> uint {
19471947
do as_bytes(s) |buf| {
1948-
let vcap = vec::capacity(buf);
1948+
let vcap = vec::capacity(*buf);
19491949
assert vcap > 0u;
19501950
vcap - 1u
19511951
}
@@ -2037,7 +2037,7 @@ mod raw {
20372037

20382038
/// Form a slice from a *u8 buffer of the given length without copying.
20392039
unsafe fn buf_as_slice<T>(buf: *u8, len: uint,
2040-
f: fn(&&v: &str) -> T) -> T {
2040+
f: fn(v: &str) -> T) -> T {
20412041
let v = (buf, len + 1);
20422042
assert is_utf8(::cast::reinterpret_cast(&v));
20432043
f(::cast::transmute(move v))

branches/incoming/src/libcore/task/local_data_priv.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ unsafe fn local_data_lookup<T: Owned>(
7575
);
7676
do map_pos.map |index| {
7777
// .get() is guaranteed because of "None { false }" above.
78-
let (_, data_ptr, _) = (*map)[index].get();
79-
(index, data_ptr)
78+
let (_, data_ptr, _) = (*map)[*index].get();
79+
(*index, data_ptr)
8080
}
8181
}
8282

@@ -91,7 +91,7 @@ unsafe fn local_get_helper<T: Owned>(
9191
// was referenced in the local_data box, though, not here, so before
9292
// overwriting the local_data_box we need to give an extra reference.
9393
// We must also give an extra reference when not removing.
94-
let (index, data_ptr) = result;
94+
let (index, data_ptr) = *result;
9595
let data: @T = cast::transmute(move data_ptr);
9696
cast::bump_box_refcount(data);
9797
if do_pop {

branches/incoming/src/libcore/task/spawn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ fn each_ancestor(list: &mut AncestorList,
200200
// the end of the list, which doesn't make sense to coalesce.
201201
return do (**ancestors).map_default((None,false)) |ancestor_arc| {
202202
// NB: Takes a lock! (this ancestor node)
203-
do access_ancestors(&ancestor_arc) |nobe| {
203+
do access_ancestors(ancestor_arc) |nobe| {
204204
// Check monotonicity
205205
assert last_generation > nobe.generation;
206206
/*##########################################################*

branches/incoming/src/libcore/vec.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ pure fn slice<T: Copy>(v: &[const T], start: uint, end: uint) -> ~[T] {
338338
}
339339

340340
/// Return a slice that points into another slice.
341-
pure fn view<T>(v: &[T], start: uint, end: uint) -> &[T] {
341+
pure fn view<T>(v: &r/[T], start: uint, end: uint) -> &r/[T] {
342342
assert (start <= end);
343343
assert (end <= len(v));
344344
do as_imm_buf(v) |p, _len| {
@@ -351,7 +351,7 @@ pure fn view<T>(v: &[T], start: uint, end: uint) -> &[T] {
351351
}
352352

353353
/// Return a slice that points into another slice.
354-
pure fn mut_view<T>(v: &[mut T], start: uint, end: uint) -> &[mut T] {
354+
pure fn mut_view<T>(v: &r/[mut T], start: uint, end: uint) -> &r/[mut T] {
355355
assert (start <= end);
356356
assert (end <= len(v));
357357
do as_mut_buf(v) |p, _len| {
@@ -364,7 +364,8 @@ pure fn mut_view<T>(v: &[mut T], start: uint, end: uint) -> &[mut T] {
364364
}
365365

366366
/// Return a slice that points into another slice.
367-
pure fn const_view<T>(v: &[const T], start: uint, end: uint) -> &[const T] {
367+
pure fn const_view<T>(v: &r/[const T], start: uint,
368+
end: uint) -> &r/[const T] {
368369
assert (start <= end);
369370
assert (end <= len(v));
370371
do as_const_buf(v) |p, _len| {
@@ -969,7 +970,7 @@ pure fn find<T: Copy>(v: &[T], f: fn(T) -> bool) -> Option<T> {
969970
*/
970971
pure fn find_between<T: Copy>(v: &[T], start: uint, end: uint,
971972
f: fn(T) -> bool) -> Option<T> {
972-
position_between(v, start, end, f).map(|i| v[i])
973+
position_between(v, start, end, f).map(|i| v[*i])
973974
}
974975

975976
/**
@@ -992,7 +993,7 @@ pure fn rfind<T: Copy>(v: &[T], f: fn(T) -> bool) -> Option<T> {
992993
*/
993994
pure fn rfind_between<T: Copy>(v: &[T], start: uint, end: uint,
994995
f: fn(T) -> bool) -> Option<T> {
995-
rposition_between(v, start, end, f).map(|i| v[i])
996+
rposition_between(v, start, end, f).map(|i| v[*i])
996997
}
997998

998999
/// Find the first index containing a matching value
@@ -1526,6 +1527,7 @@ impl<T: Copy> &[const T]: CopyableVector<T> {
15261527
}
15271528

15281529
trait ImmutableVector<T> {
1530+
pure fn view(start: uint, end: uint) -> &self/[T];
15291531
pure fn foldr<U: Copy>(z: U, p: fn(T, U) -> U) -> U;
15301532
pure fn map<U>(f: fn(v: &T) -> U) -> ~[U];
15311533
pure fn mapi<U>(f: fn(uint, v: &T) -> U) -> ~[U];
@@ -1544,6 +1546,10 @@ trait ImmutableEqVector<T: Eq> {
15441546

15451547
/// Extension methods for vectors
15461548
impl<T> &[T]: ImmutableVector<T> {
1549+
/// Return a slice that points into another slice.
1550+
pure fn view(start: uint, end: uint) -> &self/[T] {
1551+
view(self, start, end)
1552+
}
15471553
/// Reduce a vector from right to left
15481554
#[inline]
15491555
pure fn foldr<U: Copy>(z: U, p: fn(T, U) -> U) -> U { foldr(self, z, p) }
@@ -2804,17 +2810,14 @@ mod tests {
28042810
assert capacity(v) == 10u;
28052811
}
28062812

2807-
/*
28082813
#[test]
2809-
#[ignore] // region inference doesn't work well enough for this yet.
28102814
fn test_view() {
28112815
let v = ~[1, 2, 3, 4, 5];
2812-
let v = view(v, 1u, 3u);
2816+
let v = v.view(1u, 3u);
28132817
assert(len(v) == 2u);
28142818
assert(v[0] == 2);
28152819
assert(v[1] == 3);
28162820
}
2817-
*/
28182821
}
28192822

28202823
// Local Variables:

branches/incoming/src/libsyntax/diagnostic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ fn highlight_lines(cm: codemap::codemap, sp: span,
262262
fn print_macro_backtrace(cm: codemap::codemap, sp: span) {
263263
do option::iter(&sp.expn_info) |ei| {
264264
let ss = option::map_default(&ei.callie.span, @~"",
265-
|span| @codemap::span_to_str(span, cm));
265+
|span| @codemap::span_to_str(*span, cm));
266266
print_diagnostic(*ss, note,
267267
fmt!("in expansion of #%s", ei.callie.name));
268268
let ss = codemap::span_to_str(ei.call_site, cm);

0 commit comments

Comments
 (0)