Skip to content

Commit 60460d1

Browse files
committed
---
yaml --- r: 63413 b: refs/heads/snap-stage3 c: a4cc34f h: refs/heads/master i: 63411: 1ad739a v: v3
1 parent 8631cb4 commit 60460d1

File tree

158 files changed

+2447
-3050
lines changed

Some content is hidden

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

158 files changed

+2447
-3050
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: a6bc5dd6efd9b43640c5067c51563262c9ea7986
4+
refs/heads/snap-stage3: a4cc34fa120cacde411ccdc6b62cc8b6f5f14e24
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/Makefile.in

Lines changed: 1 addition & 7 deletions
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,7 +208,6 @@ 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)
212211
CFG_LIBRUSTPKG_$(1) :=$(call CFG_LIB_NAME_$(1),rustpkg)
213212
CFG_LIBRUSTDOC_$(1) :=$(call CFG_LIB_NAME_$(1),rustdoc)
214213
CFG_LIBRUSTI_$(1) :=$(call CFG_LIB_NAME_$(1),rusti)
@@ -218,7 +217,6 @@ EXTRALIB_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),extra)
218217
STDLIB_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),std)
219218
LIBRUSTC_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rustc)
220219
LIBSYNTAX_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),syntax)
221-
LIBFUZZER_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),fuzzer)
222220
LIBRUSTPKG_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rustpkg)
223221
LIBRUSTDOC_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rustdoc)
224222
LIBRUSTI_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rusti)
@@ -227,7 +225,6 @@ EXTRALIB_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),extra)
227225
STDLIB_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),std)
228226
LIBRUSTC_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rustc)
229227
LIBSYNTAX_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),syntax)
230-
LIBFUZZER_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),fuzzer)
231228
LIBRUSTPKG_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rustpkg)
232229
LIBRUSTDOC_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rustdoc)
233230
LIBRUSTI_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rusti)
@@ -402,12 +399,10 @@ SREQ$(1)_T_$(2)_H_$(3) = \
402399
# Prerequisites for a working stageN compiler and libraries, for a specific target
403400
CSREQ$(1)_T_$(2)_H_$(3) = \
404401
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
405-
$$(HBIN$(1)_H_$(3))/fuzzer$$(X_$(3)) \
406402
$$(HBIN$(1)_H_$(3))/rustpkg$$(X_$(3)) \
407403
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
408404
$$(HBIN$(1)_H_$(3))/rusti$$(X_$(3)) \
409405
$$(HBIN$(1)_H_$(3))/rust$$(X_$(3)) \
410-
$$(HLIB$(1)_H_$(3))/$(CFG_LIBFUZZER_$(3)) \
411406
$$(HLIB$(1)_H_$(3))/$(CFG_LIBRUSTPKG_$(3)) \
412407
$$(HLIB$(1)_H_$(3))/$(CFG_LIBRUSTDOC_$(3)) \
413408
$$(HLIB$(1)_H_$(3))/$(CFG_LIBRUSTI_$(3)) \
@@ -416,7 +411,6 @@ CSREQ$(1)_T_$(2)_H_$(3) = \
416411
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)) \
417412
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(2)) \
418413
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(2)) \
419-
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBFUZZER_$(2)) \
420414
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTPKG_$(2)) \
421415
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTDOC_$(2)) \
422416
$$(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(xs[0]);
2829+
let first: B = f(copy 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.max()));
362+
println(fmt!("Inf-norm = %?", *numbers.iter().max().unwrap()));
363363
364364
let numbers_arc = ARC(numbers);
365365

branches/snap-stage3/doc/tutorial.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,12 +1941,14 @@ 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.
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:
19451947

19461948
~~~~
19471949
// This does
19481950
fn head<T: Copy>(v: &[T]) -> T {
1949-
v[0]
1951+
copy v[0]
19501952
}
19511953
~~~~
19521954

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

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

@@ -2142,7 +2139,7 @@ as in this version of `print_all` that copies elements.
21422139
fn print_all<T: Printable + Copy>(printable_things: ~[T]) {
21432140
let mut i = 0;
21442141
while i < printable_things.len() {
2145-
let copy_of_thing = printable_things[i];
2142+
let copy_of_thing = copy printable_things[i];
21462143
copy_of_thing.print();
21472144
i += 1;
21482145
}

branches/snap-stage3/mk/clean.mk

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,11 @@ 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))
6766
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rustpkg$(X_$(2))
6867
$(Q)rm -f $$(HBIN$(1)_H_$(2))/serializer$(X_$(2))
6968
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rustdoc$(X_$(2))
7069
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rusti$(X_$(2))
7170
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rust$(X_$(2))
72-
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBFUZZER_$(2))
7371
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUSTPKG_$(2))
7472
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUSTDOC_$(2))
7573
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_RUNTIME_$(2))
@@ -83,7 +81,6 @@ clean$(1)_H_$(2):
8381
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(EXTRALIB_GLOB_$(2))
8482
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTC_GLOB_$(2))
8583
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBSYNTAX_GLOB_$(2))
86-
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBFUZZER_GLOB_$(2))
8784
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTPKG_GLOB_$(2))
8885
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTDOC_GLOB_$(2))
8986
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTI_GLOB_$(2))
@@ -101,13 +98,11 @@ define CLEAN_TARGET_STAGE_N
10198

10299
clean$(1)_T_$(2)_H_$(3):
103100
$(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))
105101
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/rustpkg$(X_$(2))
106102
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/serializer$(X_$(2))
107103
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/rustdoc$(X_$(2))
108104
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/rusti$(X_$(2))
109105
$(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))
111106
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTPKG_$(2))
112107
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTDOC_$(2))
113108
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUNTIME_$(2))
@@ -121,7 +116,6 @@ clean$(1)_T_$(2)_H_$(3):
121116
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(EXTRALIB_GLOB_$(2))
122117
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTC_GLOB_$(2))
123118
$(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))
125119
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTPKG_GLOB_$(2))
126120
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTDOC_GLOB_$(2))
127121
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTI_GLOB_$(2))

branches/snap-stage3/mk/dist.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ PKG_FILES := \
3232
librustc \
3333
compiletest \
3434
etc \
35-
libfuzzer \
3635
libextra \
3736
libstd \
3837
libsyntax \

branches/snap-stage3/mk/pp.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ 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) \
2120
$(wildcard $(S)src/rustpkg/*.rs) \
2221
$(wildcard $(S)src/rusti/*.rs) \
2322
$(wildcard $(S)src/rust/*.rs)

branches/snap-stage3/mk/tools.mk

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
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-
1714
# The test runner that runs the cfail/rfail/rpass and bxench tests
1815
COMPILETEST_CRATE := $(S)src/compiletest/compiletest.rc
1916
COMPILETEST_INPUTS := $(wildcard $(S)src/compiletest/*rs)
@@ -38,21 +35,6 @@ RUST_INPUTS := $(wildcard $(S)src/librust/*.rs)
3835
# have tools that need to built for other targets.
3936
define TOOLS_STAGE_N_TARGET
4037

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-
5638
$$(TBIN$(1)_T_$(4)_H_$(3))/compiletest$$(X_$(4)): \
5739
$$(COMPILETEST_CRATE) $$(COMPILETEST_INPUTS) \
5840
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
@@ -128,27 +110,6 @@ endef
128110

129111
define TOOLS_STAGE_N_HOST
130112

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-
152113
$$(HBIN$(2)_H_$(4))/compiletest$$(X_$(4)): \
153114
$$(TBIN$(1)_T_$(4)_H_$(3))/compiletest$$(X_$(4)) \
154115
$$(HSREQ$(2)_H_$(4))

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

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

2525
use core::io;
2626
use core::os;
27-
use core::str;
2827
use core::uint;
2928
use core::vec;
3029

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ 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-
2219
#[cfg(rustdoc)]
2320
extern mod this(name = "rustdoc");
2421

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

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

230230
#[cfg(test)]
231231
mod tests {
232-
use core::str;
233-
234232
#[test]
235233
fn test_to_base64() {
236234
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 { *ptr::mut_offset(t.base, ofs) };
125+
return unsafe { copy *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(a);
268-
deq.add_front(b);
269-
deq.add_back(c);
267+
deq.add_front(copy a);
268+
deq.add_front(copy b);
269+
deq.add_back(copy c);
270270
assert_eq!(deq.len(), 3);
271-
deq.add_back(d);
271+
deq.add_back(copy d);
272272
assert_eq!(deq.len(), 4);
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);
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);
279279
assert_eq!(deq.len(), 0);
280-
deq.add_back(c);
280+
deq.add_back(copy c);
281281
assert_eq!(deq.len(), 1);
282-
deq.add_front(b);
282+
deq.add_front(copy b);
283283
assert_eq!(deq.len(), 2);
284-
deq.add_back(d);
284+
deq.add_back(copy d);
285285
assert_eq!(deq.len(), 3);
286-
deq.add_front(a);
286+
deq.add_front(copy a);
287287
assert_eq!(deq.len(), 4);
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);
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);
292292
}
293293

294294
#[deriving(Eq)]

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ 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-
list.push(*data); // Iterating left-to-right -- add newly to the tail.
114+
// Iterating left-to-right -- add newly to the tail.
115+
list.push(copy *data);
115116
list
116117
}
117118
}
@@ -460,35 +461,35 @@ impl<T> DList<T> {
460461
impl<T:Copy> DList<T> {
461462
/// Remove data from the head of the list. O(1).
462463
pub fn pop(@mut self) -> Option<T> {
463-
self.pop_n().map(|nobe| nobe.data)
464+
self.pop_n().map(|nobe| copy nobe.data)
464465
}
465466

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

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

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

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

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

487488
/// Get the elements of the list as a vector. O(n).
488489
pub fn to_vec(@mut self) -> ~[T] {
489490
let mut v = vec::with_capacity(self.size);
490491
for old_iter::eachi(&self) |index,data| {
491-
v[index] = *data;
492+
v[index] = copy *data;
492493
}
493494
v
494495
}

0 commit comments

Comments
 (0)