Skip to content

Commit 1ad739a

Browse files
committed
---
yaml --- r: 63411 b: refs/heads/snap-stage3 c: 319cf6e h: refs/heads/master i: 63409: d09c014 63407: b0d3d9d v: v3
1 parent cb57313 commit 1ad739a

File tree

159 files changed

+5059
-1990
lines changed

Some content is hidden

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

159 files changed

+5059
-1990
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: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 81506a6b819dbcef0893307becaba03edf5e4bbe
4+
refs/heads/snap-stage3: 319cf6e465f203c794d71800808c2bd60a1e7613
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/Makefile.in

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ ifdef SAVE_TEMPS
111111
CFG_RUSTC_FLAGS += --save-temps
112112
endif
113113
ifdef ASM_COMMENTS
114-
CFG_RUSTC_FLAGS += -Z asm-comments
114+
CFG_RUSTC_FLAGS += -z asm-comments
115115
endif
116116
ifdef TIME_PASSES
117117
CFG_RUSTC_FLAGS += -Z time-passes
@@ -208,6 +208,7 @@ CFG_STDLIB_$(1) :=$(call CFG_LIB_NAME_$(1),std)
208208
CFG_EXTRALIB_$(1) :=$(call CFG_LIB_NAME_$(1),extra)
209209
CFG_LIBRUSTC_$(1) :=$(call CFG_LIB_NAME_$(1),rustc)
210210
CFG_LIBSYNTAX_$(1) :=$(call CFG_LIB_NAME_$(1),syntax)
211+
CFG_LIBFUZZER_$(1) :=$(call CFG_LIB_NAME_$(1),fuzzer)
211212
CFG_LIBRUSTPKG_$(1) :=$(call CFG_LIB_NAME_$(1),rustpkg)
212213
CFG_LIBRUSTDOC_$(1) :=$(call CFG_LIB_NAME_$(1),rustdoc)
213214
CFG_LIBRUSTI_$(1) :=$(call CFG_LIB_NAME_$(1),rusti)
@@ -217,6 +218,7 @@ EXTRALIB_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),extra)
217218
STDLIB_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),std)
218219
LIBRUSTC_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rustc)
219220
LIBSYNTAX_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),syntax)
221+
LIBFUZZER_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),fuzzer)
220222
LIBRUSTPKG_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rustpkg)
221223
LIBRUSTDOC_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rustdoc)
222224
LIBRUSTI_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rusti)
@@ -225,6 +227,7 @@ EXTRALIB_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),extra)
225227
STDLIB_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),std)
226228
LIBRUSTC_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rustc)
227229
LIBSYNTAX_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),syntax)
230+
LIBFUZZER_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),fuzzer)
228231
LIBRUSTPKG_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rustpkg)
229232
LIBRUSTDOC_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rustdoc)
230233
LIBRUSTI_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rusti)
@@ -399,10 +402,12 @@ SREQ$(1)_T_$(2)_H_$(3) = \
399402
# Prerequisites for a working stageN compiler and libraries, for a specific target
400403
CSREQ$(1)_T_$(2)_H_$(3) = \
401404
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
405+
$$(HBIN$(1)_H_$(3))/fuzzer$$(X_$(3)) \
402406
$$(HBIN$(1)_H_$(3))/rustpkg$$(X_$(3)) \
403407
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
404408
$$(HBIN$(1)_H_$(3))/rusti$$(X_$(3)) \
405409
$$(HBIN$(1)_H_$(3))/rust$$(X_$(3)) \
410+
$$(HLIB$(1)_H_$(3))/$(CFG_LIBFUZZER_$(3)) \
406411
$$(HLIB$(1)_H_$(3))/$(CFG_LIBRUSTPKG_$(3)) \
407412
$$(HLIB$(1)_H_$(3))/$(CFG_LIBRUSTDOC_$(3)) \
408413
$$(HLIB$(1)_H_$(3))/$(CFG_LIBRUSTI_$(3)) \
@@ -411,6 +416,7 @@ CSREQ$(1)_T_$(2)_H_$(3) = \
411416
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)) \
412417
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(2)) \
413418
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(2)) \
419+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBFUZZER_$(2)) \
414420
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTPKG_$(2)) \
415421
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTDOC_$(2)) \
416422
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTI_$(2)) \

branches/snap-stage3/doc/rust.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2826,7 +2826,7 @@ Within the body of an item that has type parameter declarations, the names of it
28262826
~~~~~~~
28272827
fn map<A: Copy, B: Copy>(f: &fn(A) -> B, xs: &[A]) -> ~[B] {
28282828
if xs.len() == 0 { return ~[]; }
2829-
let first: B = f(copy xs[0]);
2829+
let first: B = f(xs[0]);
28302830
let rest: ~[B] = map(f, xs.slice(1, xs.len()));
28312831
return ~[first] + rest;
28322832
}

branches/snap-stage3/doc/tutorial-tasks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ fn pnorm(nums: &~[float], p: uint) -> float {
359359
360360
fn main() {
361361
let numbers = vec::from_fn(1000000, |_| rand::random::<float>());
362-
println(fmt!("Inf-norm = %?", *numbers.iter().max().unwrap()));
362+
println(fmt!("Inf-norm = %?", numbers.max()));
363363
364364
let numbers_arc = ARC(numbers);
365365

branches/snap-stage3/doc/tutorial.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,14 +1941,12 @@ fn head_bad<T>(v: &[T]) -> T {
19411941
~~~~
19421942

19431943
However, we can tell the compiler that the `head` function is only for
1944-
copyable types: that is, those that have the `Copy` trait. In that
1945-
case, we can explicitly create a second copy of the value we are
1946-
returning using the `copy` keyword:
1944+
copyable types: that is, those that have the `Copy` trait.
19471945

19481946
~~~~
19491947
// This does
19501948
fn head<T: Copy>(v: &[T]) -> T {
1951-
copy v[0]
1949+
v[0]
19521950
}
19531951
~~~~
19541952

@@ -2041,12 +2039,17 @@ themselves contain type parameters. A trait for generalized sequence
20412039
types might look like the following:
20422040

20432041
~~~~
2042+
# use std::vec;
20442043
trait Seq<T> {
2045-
fn length(&self) -> uint;
2044+
fn len(&self) -> uint;
2045+
fn iter(&self, b: &fn(v: &T));
20462046
}
20472047
20482048
impl<T> Seq<T> for ~[T] {
2049-
fn length(&self) -> uint { self.len() }
2049+
fn len(&self) -> uint { self.len() }
2050+
fn iter(&self, b: &fn(v: &T)) {
2051+
for vec::each(*self) |elt| { b(elt); }
2052+
}
20502053
}
20512054
~~~~
20522055

@@ -2139,7 +2142,7 @@ as in this version of `print_all` that copies elements.
21392142
fn print_all<T: Printable + Copy>(printable_things: ~[T]) {
21402143
let mut i = 0;
21412144
while i < printable_things.len() {
2142-
let copy_of_thing = copy printable_things[i];
2145+
let copy_of_thing = printable_things[i];
21432146
copy_of_thing.print();
21442147
i += 1;
21452148
}

branches/snap-stage3/mk/clean.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@ define CLEAN_HOST_STAGE_N
6363

6464
clean$(1)_H_$(2):
6565
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rustc$(X_$(2))
66+
$(Q)rm -f $$(HBIN$(1)_H_$(2))/fuzzer$(X_$(2))
6667
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rustpkg$(X_$(2))
6768
$(Q)rm -f $$(HBIN$(1)_H_$(2))/serializer$(X_$(2))
6869
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rustdoc$(X_$(2))
6970
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rusti$(X_$(2))
7071
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rust$(X_$(2))
72+
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBFUZZER_$(2))
7173
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUSTPKG_$(2))
7274
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUSTDOC_$(2))
7375
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_RUNTIME_$(2))
@@ -81,6 +83,7 @@ clean$(1)_H_$(2):
8183
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(EXTRALIB_GLOB_$(2))
8284
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTC_GLOB_$(2))
8385
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBSYNTAX_GLOB_$(2))
86+
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBFUZZER_GLOB_$(2))
8487
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTPKG_GLOB_$(2))
8588
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTDOC_GLOB_$(2))
8689
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTI_GLOB_$(2))
@@ -98,11 +101,13 @@ define CLEAN_TARGET_STAGE_N
98101

99102
clean$(1)_T_$(2)_H_$(3):
100103
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/rustc$(X_$(2))
104+
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/fuzzer$(X_$(2))
101105
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/rustpkg$(X_$(2))
102106
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/serializer$(X_$(2))
103107
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/rustdoc$(X_$(2))
104108
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/rusti$(X_$(2))
105109
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/rust$(X_$(2))
110+
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBFUZZER_$(2))
106111
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTPKG_$(2))
107112
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTDOC_$(2))
108113
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUNTIME_$(2))
@@ -116,6 +121,7 @@ clean$(1)_T_$(2)_H_$(3):
116121
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(EXTRALIB_GLOB_$(2))
117122
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTC_GLOB_$(2))
118123
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBSYNTAX_GLOB_$(2))
124+
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBFUZZER_GLOB_$(2))
119125
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTPKG_GLOB_$(2))
120126
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTDOC_GLOB_$(2))
121127
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTI_GLOB_$(2))

branches/snap-stage3/mk/dist.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ PKG_FILES := \
3232
librustc \
3333
compiletest \
3434
etc \
35+
libfuzzer \
3536
libextra \
3637
libstd \
3738
libsyntax \

branches/snap-stage3/mk/pp.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ else
1717
$(wildcard $(addprefix $(S)src/rustc/,*.rs */*.rs */*/*.rs)) \
1818
$(wildcard $(S)src/test/*/*.rs \
1919
$(S)src/test/*/*/*.rs) \
20+
$(wildcard $(S)src/fuzzer/*.rs) \
2021
$(wildcard $(S)src/rustpkg/*.rs) \
2122
$(wildcard $(S)src/rusti/*.rs) \
2223
$(wildcard $(S)src/rust/*.rs)

branches/snap-stage3/mk/tools.mk

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
# Rules for non-core tools built with the compiler, both for target
1212
# and host architectures
1313

14+
FUZZER_LIB := $(S)src/libfuzzer/fuzzer.rc
15+
FUZZER_INPUTS := $(wildcard $(addprefix $(S)src/libfuzzer/, *.rs))
16+
1417
# The test runner that runs the cfail/rfail/rpass and bxench tests
1518
COMPILETEST_CRATE := $(S)src/compiletest/compiletest.rc
1619
COMPILETEST_INPUTS := $(wildcard $(S)src/compiletest/*rs)
@@ -35,6 +38,21 @@ RUST_INPUTS := $(wildcard $(S)src/librust/*.rs)
3538
# have tools that need to built for other targets.
3639
define TOOLS_STAGE_N_TARGET
3740

41+
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBFUZZER_$(4)): \
42+
$$(FUZZER_LIB) $$(FUZZER_INPUTS) \
43+
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
44+
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_STDLIB_$(4)) \
45+
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_EXTRALIB_$(4)) \
46+
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTC_$(4))
47+
@$$(call E, compile_and_link: $$@)
48+
$$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$< && touch $$@
49+
50+
$$(TBIN$(1)_T_$(4)_H_$(3))/fuzzer$$(X_$(4)): \
51+
$$(DRIVER_CRATE) \
52+
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBFUZZER_$(4))
53+
@$$(call E, compile_and_link: $$@)
54+
$$(STAGE$(1)_T_$(4)_H_$(3)) --cfg fuzzer -o $$@ $$<
55+
3856
$$(TBIN$(1)_T_$(4)_H_$(3))/compiletest$$(X_$(4)): \
3957
$$(COMPILETEST_CRATE) $$(COMPILETEST_INPUTS) \
4058
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
@@ -110,6 +128,27 @@ endef
110128

111129
define TOOLS_STAGE_N_HOST
112130

131+
132+
# Promote the stageN target to stageN+1 host
133+
# FIXME: Shouldn't need to depend on host/librustc.so once
134+
# rpath is working
135+
$$(HLIB$(2)_H_$(4))/$(CFG_LIBFUZZER_$(4)): \
136+
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBFUZZER_$(4)) \
137+
$$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTC_$(4)) \
138+
$$(HSREQ$(2)_H_$(4))
139+
@$$(call E, cp: $$@)
140+
$$(Q)cp $$< $$@
141+
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBFUZZER_GLOB_$(4)) \
142+
$$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBFUZZER_DSYM_GLOB_$(4))) \
143+
$$(HLIB$(2)_H_$(4))
144+
145+
$$(HBIN$(2)_H_$(4))/fuzzer$$(X_$(4)): \
146+
$$(TBIN$(1)_T_$(4)_H_$(3))/fuzzer$$(X_$(4)) \
147+
$$(HLIB$(2)_H_$(4))/$(CFG_LIBFUZZER_$(4)) \
148+
$$(HSREQ$(2)_H_$(4))
149+
@$$(call E, cp: $$@)
150+
$$(Q)cp $$< $$@
151+
113152
$$(HBIN$(2)_H_$(4))/compiletest$$(X_$(4)): \
114153
$$(TBIN$(1)_T_$(4)_H_$(3))/compiletest$$(X_$(4)) \
115154
$$(HSREQ$(2)_H_$(4))

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use util::logv;
2424

2525
use core::io;
2626
use core::os;
27+
use core::str;
2728
use core::uint;
2829
use core::vec;
2930

branches/snap-stage3/src/driver/driver.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ extern mod core(name = "std", vers = "0.7-pre");
1616
#[cfg(rustpkg)]
1717
extern mod this(name = "rustpkg");
1818

19+
#[cfg(fuzzer)]
20+
extern mod this(name = "fuzzer");
21+
1922
#[cfg(rustdoc)]
2023
extern mod this(name = "rustdoc");
2124

branches/snap-stage3/src/libextra/base64.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ impl<'self> FromBase64 for &'self str {
229229

230230
#[cfg(test)]
231231
mod tests {
232+
use core::str;
233+
232234
#[test]
233235
fn test_to_base64() {
234236
assert_eq!("".to_base64(), ~"");

branches/snap-stage3/src/libextra/c_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ pub unsafe fn c_vec_with_dtor<T>(base: *mut T, len: uint, dtor: @fn())
122122
*/
123123
pub fn get<T:Copy>(t: CVec<T>, ofs: uint) -> T {
124124
assert!(ofs < len(t));
125-
return unsafe { copy *ptr::mut_offset(t.base, ofs) };
125+
return unsafe { *ptr::mut_offset(t.base, ofs) };
126126
}
127127

128128
/**

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -264,31 +264,31 @@ mod tests {
264264
fn test_parameterized<T:Copy + Eq>(a: T, b: T, c: T, d: T) {
265265
let mut deq = Deque::new();
266266
assert_eq!(deq.len(), 0);
267-
deq.add_front(copy a);
268-
deq.add_front(copy b);
269-
deq.add_back(copy c);
267+
deq.add_front(a);
268+
deq.add_front(b);
269+
deq.add_back(c);
270270
assert_eq!(deq.len(), 3);
271-
deq.add_back(copy d);
271+
deq.add_back(d);
272272
assert_eq!(deq.len(), 4);
273-
assert_eq!(copy *deq.peek_front(), copy b);
274-
assert_eq!(copy *deq.peek_back(), copy d);
275-
assert_eq!(deq.pop_front(), copy b);
276-
assert_eq!(deq.pop_back(), copy d);
277-
assert_eq!(deq.pop_back(), copy c);
278-
assert_eq!(deq.pop_back(), copy a);
273+
assert_eq!(*deq.peek_front(), b);
274+
assert_eq!(*deq.peek_back(), d);
275+
assert_eq!(deq.pop_front(), b);
276+
assert_eq!(deq.pop_back(), d);
277+
assert_eq!(deq.pop_back(), c);
278+
assert_eq!(deq.pop_back(), a);
279279
assert_eq!(deq.len(), 0);
280-
deq.add_back(copy c);
280+
deq.add_back(c);
281281
assert_eq!(deq.len(), 1);
282-
deq.add_front(copy b);
282+
deq.add_front(b);
283283
assert_eq!(deq.len(), 2);
284-
deq.add_back(copy d);
284+
deq.add_back(d);
285285
assert_eq!(deq.len(), 3);
286-
deq.add_front(copy a);
286+
deq.add_front(a);
287287
assert_eq!(deq.len(), 4);
288-
assert_eq!(copy *deq.get(0), copy a);
289-
assert_eq!(copy *deq.get(1), copy b);
290-
assert_eq!(copy *deq.get(2), copy c);
291-
assert_eq!(copy *deq.get(3), copy d);
288+
assert_eq!(*deq.get(0), a);
289+
assert_eq!(*deq.get(1), b);
290+
assert_eq!(*deq.get(2), c);
291+
assert_eq!(*deq.get(3), d);
292292
}
293293

294294
#[deriving(Eq)]

branches/snap-stage3/src/libextra/dlist.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ pub fn from_elem<T>(data: T) -> @mut DList<T> {
111111
/// Creates a new dlist from a vector of elements, maintaining the same order
112112
pub fn from_vec<T:Copy>(vec: &[T]) -> @mut DList<T> {
113113
do vec.iter().fold(DList()) |list,data| {
114-
// Iterating left-to-right -- add newly to the tail.
115-
list.push(copy *data);
114+
list.push(*data); // Iterating left-to-right -- add newly to the tail.
116115
list
117116
}
118117
}
@@ -461,35 +460,35 @@ impl<T> DList<T> {
461460
impl<T:Copy> DList<T> {
462461
/// Remove data from the head of the list. O(1).
463462
pub fn pop(@mut self) -> Option<T> {
464-
self.pop_n().map(|nobe| copy nobe.data)
463+
self.pop_n().map(|nobe| nobe.data)
465464
}
466465

467466
/// Remove data from the tail of the list. O(1).
468467
pub fn pop_tail(@mut self) -> Option<T> {
469-
self.pop_tail_n().map(|nobe| copy nobe.data)
468+
self.pop_tail_n().map(|nobe| nobe.data)
470469
}
471470

472471
/// Get data at the list's head. O(1).
473472
pub fn peek(@mut self) -> Option<T> {
474-
self.peek_n().map(|nobe| copy nobe.data)
473+
self.peek_n().map(|nobe| nobe.data)
475474
}
476475

477476
/// Get data at the list's tail. O(1).
478477
pub fn peek_tail(@mut self) -> Option<T> {
479-
self.peek_tail_n().map (|nobe| copy nobe.data)
478+
self.peek_tail_n().map (|nobe| nobe.data)
480479
}
481480

482481
/// Get data at the list's head, failing if empty. O(1).
483-
pub fn head(@mut self) -> T { copy self.head_n().data }
482+
pub fn head(@mut self) -> T { self.head_n().data }
484483

485484
/// Get data at the list's tail, failing if empty. O(1).
486-
pub fn tail(@mut self) -> T { copy self.tail_n().data }
485+
pub fn tail(@mut self) -> T { self.tail_n().data }
487486

488487
/// Get the elements of the list as a vector. O(n).
489488
pub fn to_vec(@mut self) -> ~[T] {
490489
let mut v = vec::with_capacity(self.size);
491490
for old_iter::eachi(&self) |index,data| {
492-
v[index] = copy *data;
491+
v[index] = *data;
493492
}
494493
v
495494
}

0 commit comments

Comments
 (0)