From 58bea31ca0e11bf49439d33e1d21f11de7161567 Mon Sep 17 00:00:00 2001 From: Eduard Burtescu Date: Thu, 2 Oct 2014 08:10:09 +0300 Subject: [PATCH] tests: remove uses of Gc. --- src/liballoc/rc.rs | 8 - src/libcollections/ringbuf.rs | 44 ----- src/libcoretest/iter.rs | 5 +- src/libdebug/repr.rs | 4 - src/librustrt/local_data.rs | 17 +- src/librustrt/task.rs | 34 +--- src/test/auxiliary/cci_nested_lib.rs | 7 +- .../crate-method-reexport-grrrrrrr2.rs | 3 +- src/test/auxiliary/issue-2631-a.rs | 4 +- src/test/auxiliary/issue-5521.rs | 3 +- src/test/auxiliary/issue13507.rs | 2 - src/test/bench/task-perf-alloc-unwind.rs | 28 +-- src/test/compile-fail/autoderef-full-lval.rs | 27 ++- ...orrowck-borrow-immut-deref-of-gc-as-mut.rs | 25 --- .../borrowck-managed-pointer-deref-scope.rs | 34 ---- .../borrowck-preserve-box-in-field.rs | 38 ---- .../borrowck-preserve-box-in-uniq.rs | 38 ---- .../compile-fail/borrowck-preserve-box.rs | 36 ---- .../borrowck-preserve-cond-box.rs | 46 ----- .../borrowck-preserve-expl-deref.rs | 38 ---- src/test/compile-fail/box-static-bound.rs | 22 --- .../check-static-values-constraints.rs | 4 - .../compile-fail/core-tls-store-pointer.rs | 6 +- src/test/compile-fail/issue-14915.rs | 4 - src/test/compile-fail/issue-2063-resource.rs | 11 +- src/test/compile-fail/issue-3668.rs | 11 +- src/test/compile-fail/issue-3763.rs | 5 - src/test/compile-fail/issue-7061.rs | 7 +- src/test/compile-fail/issue-7364.rs | 3 +- src/test/compile-fail/kindck-copy.rs | 4 +- .../compile-fail/kindck-destructor-owned.rs | 4 +- src/test/compile-fail/kindck-nonsendable-1.rs | 6 +- src/test/compile-fail/lint-heap-memory.rs | 30 ---- .../compile-fail/lint-managed-heap-memory.rs | 23 --- src/test/compile-fail/new-box-syntax-bad.rs | 24 --- src/test/compile-fail/no-send-res-ports.rs | 12 +- src/test/compile-fail/occurs-check-2.rs | 3 +- src/test/compile-fail/occurs-check.rs | 4 +- src/test/compile-fail/pinned-deep-copy.rs | 50 ------ .../regions-appearance-constraint.rs | 36 ---- .../regions-infer-borrow-scope-too-big.rs | 4 +- .../regions-infer-borrow-scope-within-loop.rs | 4 +- .../regions-infer-paramd-indirect.rs | 16 +- src/test/compile-fail/static-region-bound.rs | 4 +- .../struct-field-assignability.rs | 4 +- src/test/compile-fail/terr-sorts.rs | 6 +- .../trait-impl-method-mismatch.rs | 6 +- src/test/compile-fail/unique-unique-kind.rs | 4 +- src/test/compile-fail/unique-vec-res.rs | 17 +- src/test/compile-fail/unsendable-class.rs | 8 +- src/test/debuginfo/borrowed-managed-basic.rs | 166 ------------------ src/test/debuginfo/borrowed-struct.rs | 25 --- src/test/debuginfo/borrowed-tuple.rs | 11 -- src/test/debuginfo/box.rs | 12 -- src/test/debuginfo/boxed-struct.rs | 17 -- .../by-value-self-argument-in-trait-impl.rs | 19 -- src/test/debuginfo/managed-enum.rs | 85 --------- .../managed-pointer-within-unique-vec.rs | 63 ------- .../managed-pointer-within-unique.rs | 62 ------- src/test/debuginfo/recursive-struct.rs | 98 ----------- .../var-captured-in-nested-closure.rs | 13 +- .../var-captured-in-stack-closure.rs | 9 +- src/test/pretty/block-disambig.rs | 17 +- src/test/run-fail/args-fail.rs | 6 +- src/test/run-fail/issue-2272.rs | 29 --- src/test/run-fail/unwind-assert.rs | 19 -- src/test/run-fail/unwind-box-fn-unique.rs | 29 --- src/test/run-fail/unwind-box-res.rs | 50 ------ src/test/run-fail/unwind-box-str.rs | 26 --- src/test/run-fail/unwind-box-unique-unique.rs | 26 --- src/test/run-fail/unwind-box-unique.rs | 26 --- src/test/run-fail/unwind-box-vec.rs | 26 --- src/test/run-fail/unwind-box.rs | 23 --- src/test/run-fail/unwind-fail.rs | 19 -- .../run-fail/unwind-initializer-indirect.rs | 20 --- src/test/run-fail/unwind-initializer.rs | 20 --- src/test/run-fail/unwind-iter.rs | 26 --- src/test/run-fail/unwind-iter2.rs | 23 --- src/test/run-fail/unwind-lambda.rs | 32 ---- src/test/run-fail/unwind-match.rs | 28 --- src/test/run-fail/unwind-misc-1.rs | 31 ---- src/test/run-fail/unwind-move.rs | 23 --- src/test/run-fail/unwind-nested.rs | 24 --- src/test/run-fail/unwind-partial-box.rs | 31 ---- src/test/run-fail/unwind-partial-unique.rs | 31 ---- src/test/run-fail/unwind-partial-vec.rs | 31 ---- src/test/run-fail/unwind-resource-fail.rs | 29 --- src/test/run-fail/unwind-resource-fail2.rs | 30 ---- src/test/run-fail/unwind-resource-fail3.rs | 33 ---- src/test/run-fail/unwind-stacked.rs | 29 --- src/test/run-fail/unwind-tup.rs | 22 --- src/test/run-fail/unwind-tup2.rs | 26 --- src/test/run-fail/unwind-uninitialized.rs | 23 --- src/test/run-pass/assert-eq-macro-success.rs | 3 - .../run-pass/autoderef-method-priority.rs | 6 +- .../autoref-intermediate-types-issue-3585.rs | 10 +- src/test/run-pass/binops.rs | 8 - .../borrowck-borrow-from-expr-block.rs | 6 +- .../borrowck-preserve-box-in-moved-value.rs | 37 ---- .../run-pass/borrowck-root-while-cond-2.rs | 20 --- src/test/run-pass/borrowck-root-while-cond.rs | 21 --- src/test/run-pass/borrowck-univariant-enum.rs | 5 +- src/test/run-pass/box-compare.rs | 20 --- src/test/run-pass/box-in-tup.rs | 17 -- src/test/run-pass/box-inside-if.rs | 24 --- src/test/run-pass/box-inside-if2.rs | 24 --- src/test/run-pass/box-pattern.rs | 20 --- src/test/run-pass/box-unbox.rs | 23 --- src/test/run-pass/box.rs | 14 -- .../run-pass/boxed-class-type-substitution.rs | 37 ---- src/test/run-pass/cci_borrow.rs | 3 +- src/test/run-pass/classes-self-referential.rs | 4 +- src/test/run-pass/cleanup-copy-mode.rs | 21 --- .../crate-method-reexport-grrrrrrr.rs | 4 +- src/test/run-pass/cycle-collection.rs | 27 --- src/test/run-pass/deref-lval.rs | 7 +- src/test/run-pass/deref.rs | 4 +- src/test/run-pass/double-unbox.rs | 21 --- src/test/run-pass/drop-on-empty-block-exit.rs | 6 +- src/test/run-pass/enum-null-pointer-opt.rs | 4 +- .../enum-nullable-simplifycfg-misopt.rs | 6 +- src/test/run-pass/evec-internal-boxes.rs | 22 --- src/test/run-pass/export-non-interference.rs | 4 +- src/test/run-pass/expr-block-box.rs | 14 -- src/test/run-pass/expr-block-generic-box1.rs | 30 ---- src/test/run-pass/expr-block-generic-box2.rs | 26 --- src/test/run-pass/expr-block-ref.rs | 15 -- src/test/run-pass/expr-elseif-ref.rs | 20 --- src/test/run-pass/expr-elseif-ref2.rs | 23 --- src/test/run-pass/expr-if-box.rs | 25 --- src/test/run-pass/expr-if-generic-box1.rs | 26 --- src/test/run-pass/expr-if-generic-box2.rs | 26 --- src/test/run-pass/expr-match-box.rs | 26 --- src/test/run-pass/expr-match-generic-box1.rs | 26 --- src/test/run-pass/expr-match-generic-box2.rs | 26 --- src/test/run-pass/exterior.rs | 5 +- src/test/run-pass/fail-during-tld-destroy.rs | 30 +--- src/test/run-pass/gc-vec.rs | 22 --- src/test/run-pass/generic-alias-box.rs | 23 --- src/test/run-pass/generic-box.rs | 21 --- src/test/run-pass/generic-drop-glue.rs | 18 -- src/test/run-pass/generic-exterior-box.rs | 22 --- src/test/run-pass/generic-fn-box.rs | 18 -- src/test/run-pass/generic-ivec.rs | 15 -- src/test/run-pass/generic-recursive-tag.rs | 12 +- src/test/run-pass/generic-tag.rs | 6 +- src/test/run-pass/ifmt.rs | 2 - src/test/run-pass/init-res-into-things.rs | 42 ++--- src/test/run-pass/issue-14082.rs | 9 +- src/test/run-pass/issue-2631-b.rs | 7 +- src/test/run-pass/issue-2708.rs | 4 +- src/test/run-pass/issue-2735-2.rs | 11 +- src/test/run-pass/issue-2735-3.rs | 11 +- src/test/run-pass/issue-3012-2.rs | 3 +- src/test/run-pass/issue-3121.rs | 6 +- src/test/run-pass/issue-3447.rs | 5 +- src/test/run-pass/issue-3556.rs | 35 ++-- src/test/run-pass/issue-5884.rs | 4 +- src/test/run-pass/issue-6117.rs | 4 +- src/test/run-pass/issue-8898.rs | 4 - src/test/run-pass/issue-8983.rs | 20 --- src/test/run-pass/issue-979.rs | 11 +- src/test/run-pass/issue-980.rs | 29 --- src/test/run-pass/leak-box-as-tydesc.rs | 16 -- src/test/run-pass/leak-tag-copy.rs | 18 -- src/test/run-pass/list.rs | 6 +- src/test/run-pass/mlist.rs | 16 -- src/test/run-pass/move-1.rs | 30 ---- src/test/run-pass/move-2.rs | 4 +- src/test/run-pass/move-3.rs | 29 --- src/test/run-pass/move-4.rs | 6 +- src/test/run-pass/move-arg-2.rs | 8 +- src/test/run-pass/mutable-vec-drop.rs | 23 --- src/test/run-pass/mutual-recursion-group.rs | 8 +- src/test/run-pass/new-box-syntax.rs | 9 +- src/test/run-pass/newtype-struct-drop-run.rs | 7 +- .../nullable-pointer-iotareduction.rs | 2 - src/test/run-pass/nullable-pointer-size.rs | 2 - ...cts-owned-object-borrowed-method-header.rs | 42 ----- src/test/run-pass/option-unwrap.rs | 10 +- src/test/run-pass/output-slot-variants.rs | 22 ++- src/test/run-pass/packed-struct-size.rs | 5 +- src/test/run-pass/packed-tuple-struct-size.rs | 5 +- src/test/run-pass/pass-by-copy.rs | 26 --- src/test/run-pass/rcvr-borrowed-to-region.rs | 11 -- src/test/run-pass/regions-borrow-at.rs | 4 +- .../run-pass/regions-escape-into-other-fn.rs | 4 +- ...gions-infer-borrow-scope-within-loop-ok.rs | 4 +- .../run-pass/regions-infer-borrow-scope.rs | 4 +- .../run-pass/resource-assign-is-not-copy.rs | 16 +- src/test/run-pass/resource-destruct.rs | 13 +- src/test/run-pass/resource-in-struct.rs | 11 +- .../run-pass/shape_intrinsic_tag_then_rec.rs | 26 ++- src/test/run-pass/terminate-in-initializer.rs | 11 +- src/test/run-pass/trait-cast.rs | 74 -------- src/test/run-pass/type-param-constraints.rs | 6 - .../run-pass/typeclasses-eq-example-static.rs | 38 ++-- src/test/run-pass/typeclasses-eq-example.rs | 40 ++--- src/test/run-pass/uniq-cc-generic.rs | 44 ----- src/test/run-pass/uniq-cc.rs | 40 ----- src/test/run-pass/unique-assign-generic.rs | 4 - src/test/run-pass/unwind-box.rs | 22 --- src/test/run-pass/unwind-resource2.rs | 38 ---- src/test/run-pass/vec-drop.rs | 23 --- src/test/run-pass/vec-slice-drop.rs | 11 +- src/test/run-pass/weird-exprs.rs | 5 +- 206 files changed, 322 insertions(+), 3702 deletions(-) delete mode 100644 src/test/compile-fail/borrowck-borrow-immut-deref-of-gc-as-mut.rs delete mode 100644 src/test/compile-fail/borrowck-managed-pointer-deref-scope.rs delete mode 100644 src/test/compile-fail/borrowck-preserve-box-in-field.rs delete mode 100644 src/test/compile-fail/borrowck-preserve-box-in-uniq.rs delete mode 100644 src/test/compile-fail/borrowck-preserve-box.rs delete mode 100644 src/test/compile-fail/borrowck-preserve-cond-box.rs delete mode 100644 src/test/compile-fail/borrowck-preserve-expl-deref.rs delete mode 100644 src/test/compile-fail/box-static-bound.rs delete mode 100644 src/test/compile-fail/lint-heap-memory.rs delete mode 100644 src/test/compile-fail/lint-managed-heap-memory.rs delete mode 100644 src/test/compile-fail/new-box-syntax-bad.rs delete mode 100644 src/test/compile-fail/pinned-deep-copy.rs delete mode 100644 src/test/compile-fail/regions-appearance-constraint.rs delete mode 100644 src/test/debuginfo/borrowed-managed-basic.rs delete mode 100644 src/test/debuginfo/managed-enum.rs delete mode 100644 src/test/debuginfo/managed-pointer-within-unique-vec.rs delete mode 100644 src/test/debuginfo/managed-pointer-within-unique.rs delete mode 100644 src/test/run-fail/issue-2272.rs delete mode 100644 src/test/run-fail/unwind-assert.rs delete mode 100644 src/test/run-fail/unwind-box-fn-unique.rs delete mode 100644 src/test/run-fail/unwind-box-res.rs delete mode 100644 src/test/run-fail/unwind-box-str.rs delete mode 100644 src/test/run-fail/unwind-box-unique-unique.rs delete mode 100644 src/test/run-fail/unwind-box-unique.rs delete mode 100644 src/test/run-fail/unwind-box-vec.rs delete mode 100644 src/test/run-fail/unwind-box.rs delete mode 100644 src/test/run-fail/unwind-fail.rs delete mode 100644 src/test/run-fail/unwind-initializer-indirect.rs delete mode 100644 src/test/run-fail/unwind-initializer.rs delete mode 100644 src/test/run-fail/unwind-iter.rs delete mode 100644 src/test/run-fail/unwind-iter2.rs delete mode 100644 src/test/run-fail/unwind-lambda.rs delete mode 100644 src/test/run-fail/unwind-match.rs delete mode 100644 src/test/run-fail/unwind-misc-1.rs delete mode 100644 src/test/run-fail/unwind-move.rs delete mode 100644 src/test/run-fail/unwind-nested.rs delete mode 100644 src/test/run-fail/unwind-partial-box.rs delete mode 100644 src/test/run-fail/unwind-partial-unique.rs delete mode 100644 src/test/run-fail/unwind-partial-vec.rs delete mode 100644 src/test/run-fail/unwind-resource-fail.rs delete mode 100644 src/test/run-fail/unwind-resource-fail2.rs delete mode 100644 src/test/run-fail/unwind-resource-fail3.rs delete mode 100644 src/test/run-fail/unwind-stacked.rs delete mode 100644 src/test/run-fail/unwind-tup.rs delete mode 100644 src/test/run-fail/unwind-tup2.rs delete mode 100644 src/test/run-fail/unwind-uninitialized.rs delete mode 100644 src/test/run-pass/borrowck-preserve-box-in-moved-value.rs delete mode 100644 src/test/run-pass/borrowck-root-while-cond-2.rs delete mode 100644 src/test/run-pass/borrowck-root-while-cond.rs delete mode 100644 src/test/run-pass/box-compare.rs delete mode 100644 src/test/run-pass/box-in-tup.rs delete mode 100644 src/test/run-pass/box-inside-if.rs delete mode 100644 src/test/run-pass/box-inside-if2.rs delete mode 100644 src/test/run-pass/box-pattern.rs delete mode 100644 src/test/run-pass/box-unbox.rs delete mode 100644 src/test/run-pass/box.rs delete mode 100644 src/test/run-pass/boxed-class-type-substitution.rs delete mode 100644 src/test/run-pass/cleanup-copy-mode.rs delete mode 100644 src/test/run-pass/cycle-collection.rs delete mode 100644 src/test/run-pass/double-unbox.rs delete mode 100644 src/test/run-pass/evec-internal-boxes.rs delete mode 100644 src/test/run-pass/expr-block-box.rs delete mode 100644 src/test/run-pass/expr-block-generic-box1.rs delete mode 100644 src/test/run-pass/expr-block-generic-box2.rs delete mode 100644 src/test/run-pass/expr-block-ref.rs delete mode 100644 src/test/run-pass/expr-elseif-ref.rs delete mode 100644 src/test/run-pass/expr-elseif-ref2.rs delete mode 100644 src/test/run-pass/expr-if-box.rs delete mode 100644 src/test/run-pass/expr-if-generic-box1.rs delete mode 100644 src/test/run-pass/expr-if-generic-box2.rs delete mode 100644 src/test/run-pass/expr-match-box.rs delete mode 100644 src/test/run-pass/expr-match-generic-box1.rs delete mode 100644 src/test/run-pass/expr-match-generic-box2.rs delete mode 100644 src/test/run-pass/gc-vec.rs delete mode 100644 src/test/run-pass/generic-alias-box.rs delete mode 100644 src/test/run-pass/generic-box.rs delete mode 100644 src/test/run-pass/generic-drop-glue.rs delete mode 100644 src/test/run-pass/generic-exterior-box.rs delete mode 100644 src/test/run-pass/generic-fn-box.rs delete mode 100644 src/test/run-pass/generic-ivec.rs delete mode 100644 src/test/run-pass/issue-8983.rs delete mode 100644 src/test/run-pass/issue-980.rs delete mode 100644 src/test/run-pass/leak-box-as-tydesc.rs delete mode 100644 src/test/run-pass/leak-tag-copy.rs delete mode 100644 src/test/run-pass/mlist.rs delete mode 100644 src/test/run-pass/move-1.rs delete mode 100644 src/test/run-pass/move-3.rs delete mode 100644 src/test/run-pass/mutable-vec-drop.rs delete mode 100644 src/test/run-pass/objects-owned-object-borrowed-method-header.rs delete mode 100644 src/test/run-pass/pass-by-copy.rs delete mode 100644 src/test/run-pass/trait-cast.rs delete mode 100644 src/test/run-pass/uniq-cc-generic.rs delete mode 100644 src/test/run-pass/uniq-cc.rs delete mode 100644 src/test/run-pass/unwind-box.rs delete mode 100644 src/test/run-pass/unwind-resource2.rs delete mode 100644 src/test/run-pass/vec-drop.rs diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index ec19844a24a..049bf4eb1b0 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -541,14 +541,6 @@ fn test_dead() { assert!(y.upgrade().is_none()); } - #[test] - fn gc_inside() { - // see issue #11532 - use std::gc::GC; - let a = Rc::new(RefCell::new(box(GC) 1i)); - assert!(a.try_borrow_mut().is_some()); - } - #[test] fn weak_self_cyclic() { struct Cycle { diff --git a/src/libcollections/ringbuf.rs b/src/libcollections/ringbuf.rs index 0e1c39535be..c9c824ac9ce 100644 --- a/src/libcollections/ringbuf.rs +++ b/src/libcollections/ringbuf.rs @@ -532,7 +532,6 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { mod tests { use std::fmt::Show; use std::prelude::*; - use std::gc::{GC, Gc}; use std::hash; use test::Bencher; use test; @@ -587,43 +586,6 @@ fn test_simple() { assert_eq!(*d.get(3), 4); } - #[test] - #[allow(deprecated)] - fn test_boxes() { - let a: Gc = box(GC) 5; - let b: Gc = box(GC) 72; - let c: Gc = box(GC) 64; - let d: Gc = box(GC) 175; - - let mut deq = RingBuf::new(); - assert_eq!(deq.len(), 0); - deq.push_front(a); - deq.push_front(b); - deq.push(c); - assert_eq!(deq.len(), 3); - deq.push(d); - assert_eq!(deq.len(), 4); - assert_eq!(deq.front(), Some(&b)); - assert_eq!(deq.back(), Some(&d)); - assert_eq!(deq.pop_front(), Some(b)); - assert_eq!(deq.pop(), Some(d)); - assert_eq!(deq.pop(), Some(c)); - assert_eq!(deq.pop(), Some(a)); - assert_eq!(deq.len(), 0); - deq.push(c); - assert_eq!(deq.len(), 1); - deq.push_front(b); - assert_eq!(deq.len(), 2); - deq.push(d); - assert_eq!(deq.len(), 3); - deq.push_front(a); - assert_eq!(deq.len(), 4); - assert_eq!(*deq.get(0), a); - assert_eq!(*deq.get(1), b); - assert_eq!(*deq.get(2), c); - assert_eq!(*deq.get(3), d); - } - #[cfg(test)] fn test_parameterized(a: T, b: T, c: T, d: T) { let mut deq = RingBuf::new(); @@ -755,12 +717,6 @@ fn test_param_int() { test_parameterized::(5, 72, 64, 175); } - #[test] - fn test_param_at_int() { - test_parameterized::>(box(GC) 5, box(GC) 72, - box(GC) 64, box(GC) 175); - } - #[test] fn test_param_taggy() { test_parameterized::(One(1), Two(1, 2), Three(1, 2, 3), Two(17, 42)); diff --git a/src/libcoretest/iter.rs b/src/libcoretest/iter.rs index e84c8947967..9e47142478e 100644 --- a/src/libcoretest/iter.rs +++ b/src/libcoretest/iter.rs @@ -529,9 +529,8 @@ fn test_rposition() { #[test] #[should_fail] fn test_rposition_fail() { - use std::gc::GC; - let v = [(box 0i, box(GC) 0i), (box 0i, box(GC) 0i), - (box 0i, box(GC) 0i), (box 0i, box(GC) 0i)]; + let v = [(box 0i, box 0i), (box 0i, box 0i), + (box 0i, box 0i), (box 0i, box 0i)]; let mut i = 0i; v.iter().rposition(|_elt| { if i == 2 { diff --git a/src/libdebug/repr.rs b/src/libdebug/repr.rs index 98c01000cb0..e27816c8165 100644 --- a/src/libdebug/repr.rs +++ b/src/libdebug/repr.rs @@ -572,7 +572,6 @@ fn test_repr() { use std::io::stdio::println; use std::char::is_alphabetic; use std::mem::swap; - use std::gc::GC; fn exact_test(t: &T, e:&str) { let mut m = io::MemWriter::new(); @@ -587,7 +586,6 @@ fn exact_test(t: &T, e:&str) { exact_test(&1.234f64, "1.234f64"); exact_test(&("hello"), "\"hello\""); - exact_test(&(box(GC) 10i), "box(GC) 10"); exact_test(&(box 10i), "box 10"); exact_test(&(&10i), "&10"); let mut x = 10i; @@ -601,8 +599,6 @@ fn exact_test(t: &T, e:&str) { "&[\"hi\", \"there\"]"); exact_test(&(P{a:10, b:1.234}), "repr::P{a: 10, b: 1.234f64}"); - exact_test(&(box(GC) P{a:10, b:1.234}), - "box(GC) repr::P{a: 10, b: 1.234f64}"); exact_test(&(box P{a:10, b:1.234}), "box repr::P{a: 10, b: 1.234f64}"); diff --git a/src/librustrt/local_data.rs b/src/librustrt/local_data.rs index e7ce5b7dca8..fcef5981f0a 100644 --- a/src/librustrt/local_data.rs +++ b/src/librustrt/local_data.rs @@ -411,7 +411,6 @@ mod tests { extern crate test; use std::prelude::*; - use std::gc::{Gc, GC}; use super::*; use std::task; @@ -467,11 +466,11 @@ fn test_tls_crust_automorestack_memorial_bug() { #[test] fn test_tls_multiple_types() { static str_key: Key = &KeyValueKey; - static box_key: Key> = &KeyValueKey; + static box_key: Key> = &KeyValueKey; static int_key: Key = &KeyValueKey; task::spawn(proc() { str_key.replace(Some("string data".to_string())); - box_key.replace(Some(box(GC) ())); + box_key.replace(Some(box 0)); int_key.replace(Some(42)); }); } @@ -479,13 +478,13 @@ fn test_tls_multiple_types() { #[test] fn test_tls_overwrite_multiple_types() { static str_key: Key = &KeyValueKey; - static box_key: Key> = &KeyValueKey; + static box_key: Key> = &KeyValueKey; static int_key: Key = &KeyValueKey; task::spawn(proc() { str_key.replace(Some("string data".to_string())); str_key.replace(Some("string data 2".to_string())); - box_key.replace(Some(box(GC) ())); - box_key.replace(Some(box(GC) ())); + box_key.replace(Some(box 0)); + box_key.replace(Some(box 1)); int_key.replace(Some(42)); // This could cause a segfault if overwriting-destruction is done // with the crazy polymorphic transmute rather than the provided @@ -498,13 +497,13 @@ fn test_tls_overwrite_multiple_types() { #[should_fail] fn test_tls_cleanup_on_failure() { static str_key: Key = &KeyValueKey; - static box_key: Key> = &KeyValueKey; + static box_key: Key> = &KeyValueKey; static int_key: Key = &KeyValueKey; str_key.replace(Some("parent data".to_string())); - box_key.replace(Some(box(GC) ())); + box_key.replace(Some(box 0)); task::spawn(proc() { str_key.replace(Some("string data".to_string())); - box_key.replace(Some(box(GC) ())); + box_key.replace(Some(box 2)); int_key.replace(Some(42)); fail!(); }); diff --git a/src/librustrt/task.rs b/src/librustrt/task.rs index 9e88d05884c..ca5f76cf0d4 100644 --- a/src/librustrt/task.rs +++ b/src/librustrt/task.rs @@ -554,23 +554,14 @@ mod test { use super::*; use std::prelude::*; use std::task; - use std::gc::{Gc, GC}; - - #[test] - fn local_heap() { - let a = box(GC) 5i; - let b = a; - assert!(*a == 5); - assert!(*b == 5); - } #[test] fn tls() { - local_data_key!(key: Gc) - key.replace(Some(box(GC) "data".to_string())); + local_data_key!(key: String) + key.replace(Some("data".to_string())); assert_eq!(key.get().unwrap().as_slice(), "data"); - local_data_key!(key2: Gc) - key2.replace(Some(box(GC) "data".to_string())); + local_data_key!(key2: String) + key2.replace(Some("data".to_string())); assert_eq!(key2.get().unwrap().as_slice(), "data"); } @@ -605,23 +596,6 @@ fn comm_shared_chan() { assert!(rx.recv() == 10); } - #[test] - fn heap_cycles() { - use std::cell::RefCell; - - struct List { - next: Option>>, - } - - let a = box(GC) RefCell::new(List { next: None }); - let b = box(GC) RefCell::new(List { next: Some(a) }); - - { - let mut a = a.borrow_mut(); - a.next = Some(b); - } - } - #[test] #[should_fail] fn test_begin_unwind() { diff --git a/src/test/auxiliary/cci_nested_lib.rs b/src/test/auxiliary/cci_nested_lib.rs index b097e688b42..bbaf7991fd3 100644 --- a/src/test/auxiliary/cci_nested_lib.rs +++ b/src/test/auxiliary/cci_nested_lib.rs @@ -10,7 +10,6 @@ use std::cell::RefCell; -use std::gc::{Gc, GC}; pub struct Entry { key: A, @@ -19,7 +18,7 @@ pub struct Entry { pub struct alist { eq_fn: extern "Rust" fn(A,A) -> bool, - data: Gc>>>, + data: Box>>>, } pub fn alist_add(lst: &alist, k: A, v: B) { @@ -47,7 +46,7 @@ pub fn new_int_alist() -> alist { fn eq_int(a: int, b: int) -> bool { a == b } return alist { eq_fn: eq_int, - data: box(GC) RefCell::new(Vec::new()), + data: box RefCell::new(Vec::new()), }; } @@ -57,6 +56,6 @@ pub fn new_int_alist_2() -> alist { fn eq_int(a: int, b: int) -> bool { a == b } return alist { eq_fn: eq_int, - data: box(GC) RefCell::new(Vec::new()), + data: box RefCell::new(Vec::new()), }; } diff --git a/src/test/auxiliary/crate-method-reexport-grrrrrrr2.rs b/src/test/auxiliary/crate-method-reexport-grrrrrrr2.rs index e9a24900176..5e2a04001b5 100644 --- a/src/test/auxiliary/crate-method-reexport-grrrrrrr2.rs +++ b/src/test/auxiliary/crate-method-reexport-grrrrrrr2.rs @@ -27,9 +27,8 @@ fn add(&self, _s: String) { pub mod rust { pub use name_pool::add; - use std::gc::Gc; - pub type rt = Gc<()>; + pub type rt = Box<()>; pub trait cx { fn cx(&self); diff --git a/src/test/auxiliary/issue-2631-a.rs b/src/test/auxiliary/issue-2631-a.rs index 61c7d3f87df..3bedbd9089c 100644 --- a/src/test/auxiliary/issue-2631-a.rs +++ b/src/test/auxiliary/issue-2631-a.rs @@ -13,9 +13,9 @@ use std::cell::RefCell; use std::collections::HashMap; -use std::gc::Gc; +use std::rc::Rc; -pub type header_map = HashMap>>>>; +pub type header_map = HashMap>>>>; // the unused ty param is necessary so this gets monomorphized pub fn request(req: &header_map) { diff --git a/src/test/auxiliary/issue-5521.rs b/src/test/auxiliary/issue-5521.rs index 5d56db314b2..d9d393cc749 100644 --- a/src/test/auxiliary/issue-5521.rs +++ b/src/test/auxiliary/issue-5521.rs @@ -10,7 +10,6 @@ use std::collections::HashMap; -use std::gc::Gc; -pub type map = Gc>; +pub type map = Box>; diff --git a/src/test/auxiliary/issue13507.rs b/src/test/auxiliary/issue13507.rs index ee7787d6fcc..961dad00091 100644 --- a/src/test/auxiliary/issue13507.rs +++ b/src/test/auxiliary/issue13507.rs @@ -56,8 +56,6 @@ pub enum FooEnum { VarB(uint, uint) } - // Skipping ty_box - // Tests ty_uniq (of u8) pub type FooUniq = Box; diff --git a/src/test/bench/task-perf-alloc-unwind.rs b/src/test/bench/task-perf-alloc-unwind.rs index 93b22edbf03..6729373296b 100644 --- a/src/test/bench/task-perf-alloc-unwind.rs +++ b/src/test/bench/task-perf-alloc-unwind.rs @@ -10,18 +10,15 @@ #![feature(unsafe_destructor)] -extern crate collections; extern crate time; use time::precise_time_s; use std::os; use std::task; -use std::vec; -use std::gc::{Gc, GC}; #[deriving(Clone)] enum List { - Nil, Cons(T, Gc>) + Nil, Cons(T, Box>) } enum UniqueList { @@ -53,15 +50,13 @@ fn run(repeat: int, depth: int) { // Filled with things that have to be unwound struct State { - managed: Gc, unique: Box, - tuple: (Gc, Box), - vec: Vec>, + vec: Vec>, res: r } struct r { - _l: Gc, + _l: Box, } #[unsafe_destructor] @@ -69,7 +64,7 @@ impl Drop for r { fn drop(&mut self) {} } -fn r(l: Gc) -> r { +fn r(l: Box) -> r { r { _l: l } @@ -85,22 +80,17 @@ fn recurse_or_fail(depth: int, st: Option) { let st = match st { None => { State { - managed: box(GC) Nil, unique: box Nil, - tuple: (box(GC) Nil, box Nil), - vec: vec!(box(GC) Nil), - res: r(box(GC) Nil) + vec: vec!(box Nil), + res: r(box Nil) } } Some(st) => { State { - managed: box(GC) Cons((), st.managed), - unique: box Cons((), box(GC) *st.unique), - tuple: (box(GC) Cons((), st.tuple.ref0().clone()), - box Cons((), box(GC) *st.tuple.ref1().clone())), + unique: box Cons((), box *st.unique), vec: st.vec.clone().append( - &[box(GC) Cons((), *st.vec.last().unwrap())]), - res: r(box(GC) Cons((), st.res._l)) + &[box Cons((), *st.vec.last().unwrap())]), + res: r(box Cons((), st.res._l)) } } }; diff --git a/src/test/compile-fail/autoderef-full-lval.rs b/src/test/compile-fail/autoderef-full-lval.rs index 276c830cf5d..7aa3b30ce49 100644 --- a/src/test/compile-fail/autoderef-full-lval.rs +++ b/src/test/compile-fail/autoderef-full-lval.rs @@ -8,30 +8,25 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -extern crate debug; - -use std::gc::{Gc, GC}; - struct clam { - x: Gc, - y: Gc, + x: Box, + y: Box, } struct fish { - a: Gc, + a: Box, } fn main() { - let a: clam = clam{x: box(GC) 1, y: box(GC) 2}; - let b: clam = clam{x: box(GC) 10, y: box(GC) 20}; - let z: int = a.x + b.y; //~ ERROR binary operation `+` cannot be applied to type `Gc` - println!("{:?}", z); + let a: clam = clam{x: box 1, y: box 2}; + let b: clam = clam{x: box 10, y: box 20}; + let z: int = a.x + b.y; //~ ERROR binary operation `+` cannot be applied to type `Box` + println!("{}", z); assert_eq!(z, 21); - let forty: fish = fish{a: box(GC) 40}; - let two: fish = fish{a: box(GC) 2}; + let forty: fish = fish{a: box 40}; + let two: fish = fish{a: box 2}; let answer: int = forty.a + two.a; - //~^ ERROR binary operation `+` cannot be applied to type `Gc` - println!("{:?}", answer); + //~^ ERROR binary operation `+` cannot be applied to type `Box` + println!("{}", answer); assert_eq!(answer, 42); } diff --git a/src/test/compile-fail/borrowck-borrow-immut-deref-of-gc-as-mut.rs b/src/test/compile-fail/borrowck-borrow-immut-deref-of-gc-as-mut.rs deleted file mode 100644 index 91eb20d19ed..00000000000 --- a/src/test/compile-fail/borrowck-borrow-immut-deref-of-gc-as-mut.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::GC; - -struct A; - -impl A { - fn foo(&mut self) { - } -} - -pub fn main() { - let a = box(GC) A; - a.foo(); - //~^ ERROR cannot borrow immutable dereference of `Gc` `*a` as mutable -} diff --git a/src/test/compile-fail/borrowck-managed-pointer-deref-scope.rs b/src/test/compile-fail/borrowck-managed-pointer-deref-scope.rs deleted file mode 100644 index a8a79056fb1..00000000000 --- a/src/test/compile-fail/borrowck-managed-pointer-deref-scope.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Verify that managed pointers scope is treated like owned pointers. -// regression test for #11586 - - -use std::gc::{GC, Gc}; - -fn foo(x: &Gc) -> &int { - match x { - &ref y => { - &**y // Do not expect an error here - } - } -} - -fn bar() { - let a = 3i; - let mut y = &a; - if true { - let x = box(GC) 3i; - y = &*x; //~ ERROR `*x` does not live long enough - } -} - -fn main() {} diff --git a/src/test/compile-fail/borrowck-preserve-box-in-field.rs b/src/test/compile-fail/borrowck-preserve-box-in-field.rs deleted file mode 100644 index ad1ac3cc15e..00000000000 --- a/src/test/compile-fail/borrowck-preserve-box-in-field.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// exec-env:RUST_POISON_ON_FREE=1 - - -use std::gc::GC; - -fn borrow(x: &int, f: |x: &int|) { - let before = *x; - f(x); - let after = *x; - assert_eq!(before, after); -} - -struct F { f: Box } - -pub fn main() { - let mut x = box(GC) F {f: box 3}; - borrow(&*x.f, |b_x| { - //~^ ERROR cannot borrow `x` as mutable because `*x.f` is also borrowed as immutable - assert_eq!(*b_x, 3); - assert_eq!(&(*x.f) as *const int, &(*b_x) as *const int); - //~^ NOTE borrow occurs due to use of `x` in closure - x = box(GC) F {f: box 4}; - - println!("&*b_x = {:p}", &(*b_x)); - assert_eq!(*b_x, 3); - assert!(&(*x.f) as *const int != &(*b_x) as *const int); - }) -} diff --git a/src/test/compile-fail/borrowck-preserve-box-in-uniq.rs b/src/test/compile-fail/borrowck-preserve-box-in-uniq.rs deleted file mode 100644 index ec52f058836..00000000000 --- a/src/test/compile-fail/borrowck-preserve-box-in-uniq.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// exec-env:RUST_POISON_ON_FREE=1 - - -use std::gc::GC; - -fn borrow(x: &int, f: |x: &int|) { - let before = *x; - f(x); - let after = *x; - assert_eq!(before, after); -} - -struct F { f: Box } - -pub fn main() { - let mut x = box box(GC) F{f: box 3}; - borrow(&*x.f, |b_x| { - //~^ ERROR cannot borrow `x` as mutable because `*x.f` is also borrowed as immutable - assert_eq!(*b_x, 3); - assert_eq!(&(*x.f) as *const int, &(*b_x) as *const int); - //~^ NOTE borrow occurs due to use of `x` in closure - *x = box(GC) F{f: box 4}; - - println!("&*b_x = {:p}", &(*b_x)); - assert_eq!(*b_x, 3); - assert!(&(*x.f) as *const int != &(*b_x) as *const int); - }) -} diff --git a/src/test/compile-fail/borrowck-preserve-box.rs b/src/test/compile-fail/borrowck-preserve-box.rs deleted file mode 100644 index 5aff482a323..00000000000 --- a/src/test/compile-fail/borrowck-preserve-box.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// exec-env:RUST_POISON_ON_FREE=1 - - -use std::gc::GC; - -fn borrow(x: &int, f: |x: &int|) { - let before = *x; - f(x); - let after = *x; - assert_eq!(before, after); -} - -pub fn main() { - let mut x = box(GC) 3; - borrow(&*x, |b_x| { - //~^ ERROR cannot borrow `x` as mutable because `*x` is also borrowed as immutable - assert_eq!(*b_x, 3); - assert_eq!(&(*x) as *const int, &(*b_x) as *const int); - //~^ NOTE borrow occurs due to use of `x` in closure - x = box(GC) 22; - - println!("&*b_x = {:p}", &(*b_x)); - assert_eq!(*b_x, 3); - assert!(&(*x) as *const int != &(*b_x) as *const int); - }) -} diff --git a/src/test/compile-fail/borrowck-preserve-cond-box.rs b/src/test/compile-fail/borrowck-preserve-cond-box.rs deleted file mode 100644 index 6c3c340b97a..00000000000 --- a/src/test/compile-fail/borrowck-preserve-cond-box.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// exec-env:RUST_POISON_ON_FREE=1 - - -use std::gc::GC; - -fn testfn(cond: bool) { - let mut x = box(GC) 3i; - let mut y = box(GC) 4i; - - // borrow x and y - let r_x = &*x; - let r_y = &*y; - let mut r = r_x; - let mut exp = 3; - - if cond { - r = r_y; - exp = 4; - } - - println!("*r = {}, exp = {}", *r, exp); - assert_eq!(*r, exp); - - x = box(GC) 5i; //~ERROR cannot assign to `x` because it is borrowed - y = box(GC) 6i; //~ERROR cannot assign to `y` because it is borrowed - - println!("*r = {}, exp = {}", *r, exp); - assert_eq!(*r, exp); - assert_eq!(x, box(GC) 5i); - assert_eq!(y, box(GC) 6i); -} - -pub fn main() { - testfn(true); - testfn(false); -} diff --git a/src/test/compile-fail/borrowck-preserve-expl-deref.rs b/src/test/compile-fail/borrowck-preserve-expl-deref.rs deleted file mode 100644 index 2ad042c69c3..00000000000 --- a/src/test/compile-fail/borrowck-preserve-expl-deref.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// exec-env:RUST_POISON_ON_FREE=1 - - -use std::gc::GC; - -fn borrow(x: &int, f: |x: &int|) { - let before = *x; - f(x); - let after = *x; - assert_eq!(before, after); -} - -struct F { f: Box } - -pub fn main() { - let mut x = box(GC) F {f: box 3}; - borrow(&*(*x).f, |b_x| { - //~^ ERROR cannot borrow `x` as mutable because `*x.f` is also borrowed as immutable - assert_eq!(*b_x, 3); - assert_eq!(&(*x.f) as *const int, &(*b_x) as *const int); - //~^ NOTE borrow occurs due to use of `x` in closure - x = box(GC) F {f: box 4}; - - println!("&*b_x = {:p}", &(*b_x)); - assert_eq!(*b_x, 3); - assert!(&(*x.f) as *const int != &(*b_x) as *const int); - }) -} diff --git a/src/test/compile-fail/box-static-bound.rs b/src/test/compile-fail/box-static-bound.rs deleted file mode 100644 index 29ee79b0079..00000000000 --- a/src/test/compile-fail/box-static-bound.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -fn f(x: T) -> Gc { - box(GC) x //~ ERROR the parameter type `T` may not live long enough -} - -fn g(x: T) -> Gc { - box(GC) x // ok -} - -fn main() {} diff --git a/src/test/compile-fail/check-static-values-constraints.rs b/src/test/compile-fail/check-static-values-constraints.rs index 3e67419843c..e29be22ca9a 100644 --- a/src/test/compile-fail/check-static-values-constraints.rs +++ b/src/test/compile-fail/check-static-values-constraints.rs @@ -11,7 +11,6 @@ // Verifies all possible restrictions for static items values. use std::kinds::marker; -use std::gc::{Gc, GC}; struct WithDtor; @@ -124,9 +123,6 @@ fn drop(&mut self) {} static mut STATIC17: SafeEnum = Variant1; //~^ ERROR mutable static items are not allowed to have destructors -static STATIC18: Gc = box(GC) SafeStruct{field1: Variant1, field2: Variant2(0)}; -//~^ ERROR static items are not allowed to have custom pointers - static STATIC19: Box = box 3; //~^ ERROR static items are not allowed to have custom pointers diff --git a/src/test/compile-fail/core-tls-store-pointer.rs b/src/test/compile-fail/core-tls-store-pointer.rs index 06079a5487f..d77c552be03 100644 --- a/src/test/compile-fail/core-tls-store-pointer.rs +++ b/src/test/compile-fail/core-tls-store-pointer.rs @@ -8,11 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Testing that we can't store a reference it task-local storage +// Testing that we can't store a reference in task-local storage -use std::gc::{GC, Gc}; - -local_data_key!(key: Gc<&int>) +local_data_key!(key: Box<&int>) //~^ ERROR missing lifetime specifier fn main() {} diff --git a/src/test/compile-fail/issue-14915.rs b/src/test/compile-fail/issue-14915.rs index 4512eb3f70a..8cbbfb7b83a 100644 --- a/src/test/compile-fail/issue-14915.rs +++ b/src/test/compile-fail/issue-14915.rs @@ -8,12 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::gc::{GC,Gc}; - fn main() { let x: Box = box 0; - let y: Gc = box (GC) 0; println!("{}", x + 1); //~ ERROR binary operation `+` cannot be applied to type `Box` - println!("{}", y + 1); //~ ERROR binary operation `+` cannot be applied to type `Gc` } diff --git a/src/test/compile-fail/issue-2063-resource.rs b/src/test/compile-fail/issue-2063-resource.rs index 577ac480f60..30cf7ee7d88 100644 --- a/src/test/compile-fail/issue-2063-resource.rs +++ b/src/test/compile-fail/issue-2063-resource.rs @@ -9,17 +9,14 @@ // except according to those terms. -use std::gc::Gc; - // test that autoderef of a type like this does not // cause compiler to loop. Note that no instances // of such a type could ever be constructed. -struct t { //~ ERROR this type cannot be instantiated - x: x, +struct S { //~ ERROR this type cannot be instantiated + x: X, to_str: (), } -struct x(Gc); //~ ERROR this type cannot be instantiated +struct X(Box); //~ ERROR this type cannot be instantiated -fn main() { -} +fn main() {} diff --git a/src/test/compile-fail/issue-3668.rs b/src/test/compile-fail/issue-3668.rs index d3bd17a7742..cccf730095b 100644 --- a/src/test/compile-fail/issue-3668.rs +++ b/src/test/compile-fail/issue-3668.rs @@ -8,17 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -use std::gc::Gc; - -struct P { child: Option> } +struct P { child: Option> } trait PTrait { - fn getChildOption(&self) -> Option>; + fn getChildOption(&self) -> Option>; } impl PTrait for P { - fn getChildOption(&self) -> Option> { - static childVal: Gc

= self.child.get(); + fn getChildOption(&self) -> Option> { + static childVal: Box

= self.child.get(); //~^ ERROR attempt to use a non-constant value in a constant fail!(); } diff --git a/src/test/compile-fail/issue-3763.rs b/src/test/compile-fail/issue-3763.rs index 9003578a0bb..73d42aa0de1 100644 --- a/src/test/compile-fail/issue-3763.rs +++ b/src/test/compile-fail/issue-3763.rs @@ -9,8 +9,6 @@ // except according to those terms. -use std::gc::GC; - mod my_mod { pub struct MyStruct { priv_field: int @@ -29,11 +27,8 @@ fn main() { //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private let _woohoo = (box my_struct).priv_field; //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private - let _woohoo = (box(GC) my_struct).priv_field; - //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private (&my_struct).happyfun(); //~ ERROR method `happyfun` is private (box my_struct).happyfun(); //~ ERROR method `happyfun` is private - (box(GC) my_struct).happyfun(); //~ ERROR method `happyfun` is private let nope = my_struct.priv_field; //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private } diff --git a/src/test/compile-fail/issue-7061.rs b/src/test/compile-fail/issue-7061.rs index a9e9416beb3..c6869c44057 100644 --- a/src/test/compile-fail/issue-7061.rs +++ b/src/test/compile-fail/issue-7061.rs @@ -8,14 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -use std::gc::Gc; - struct BarStruct; impl<'a> BarStruct { - fn foo(&'a mut self) -> Gc { self } - //~^ ERROR: error: mismatched types: expected `Gc`, found `&'a mut BarStruct + fn foo(&'a mut self) -> Box { self } + //~^ ERROR: error: mismatched types: expected `Box`, found `&'a mut BarStruct } fn main() {} diff --git a/src/test/compile-fail/issue-7364.rs b/src/test/compile-fail/issue-7364.rs index 1c0295974c9..e29b8bc04d8 100644 --- a/src/test/compile-fail/issue-7364.rs +++ b/src/test/compile-fail/issue-7364.rs @@ -10,10 +10,9 @@ use std::cell::RefCell; -use std::gc::{Gc, GC}; // Regresion test for issue 7364 -static managed: Gc> = box(GC) RefCell::new(0); +static boxed: Box> = box RefCell::new(0); //~^ ERROR static items are not allowed to have custom pointers fn main() { } diff --git a/src/test/compile-fail/kindck-copy.rs b/src/test/compile-fail/kindck-copy.rs index 3524d11d184..499144698fb 100644 --- a/src/test/compile-fail/kindck-copy.rs +++ b/src/test/compile-fail/kindck-copy.rs @@ -12,7 +12,6 @@ use std::rc::Rc; -use std::gc::Gc; fn assert_copy() { } trait Dummy { } @@ -76,8 +75,7 @@ fn test<'a,T,U:Copy>(_: &'a int) { // structs containing non-POD are not ok assert_copy::(); //~ ERROR `core::kinds::Copy` is not implemented - // managed or ref counted types are not ok - assert_copy::>(); //~ ERROR `core::kinds::Copy` is not implemented + // ref counted types are not ok assert_copy::>(); //~ ERROR `core::kinds::Copy` is not implemented } diff --git a/src/test/compile-fail/kindck-destructor-owned.rs b/src/test/compile-fail/kindck-destructor-owned.rs index e50bb8fbede..26b0c5503e3 100644 --- a/src/test/compile-fail/kindck-destructor-owned.rs +++ b/src/test/compile-fail/kindck-destructor-owned.rs @@ -9,10 +9,10 @@ // except according to those terms. -use std::gc::Gc; +use std::rc::Rc; struct Foo { - f: Gc, + f: Rc, } impl Drop for Foo { diff --git a/src/test/compile-fail/kindck-nonsendable-1.rs b/src/test/compile-fail/kindck-nonsendable-1.rs index f292d159982..6ca3f0174bb 100644 --- a/src/test/compile-fail/kindck-nonsendable-1.rs +++ b/src/test/compile-fail/kindck-nonsendable-1.rs @@ -9,12 +9,12 @@ // except according to those terms. -use std::gc::{Gc, GC}; +use std::rc::Rc; -fn foo(_x: Gc) {} +fn foo(_x: Rc) {} fn main() { - let x = box(GC) 3u; + let x = Rc::new(3u); let _: proc():Send = proc() foo(x); //~ ERROR `core::kinds::Send` is not implemented let _: proc():Send = proc() foo(x); //~ ERROR `core::kinds::Send` is not implemented let _: proc():Send = proc() foo(x); //~ ERROR `core::kinds::Send` is not implemented diff --git a/src/test/compile-fail/lint-heap-memory.rs b/src/test/compile-fail/lint-heap-memory.rs deleted file mode 100644 index 375969ffb52..00000000000 --- a/src/test/compile-fail/lint-heap-memory.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![forbid(heap_memory)] -#![allow(dead_code)] - -use std::gc::{Gc, GC}; - -struct Foo { - x: Gc, //~ ERROR type uses managed -} - -struct Bar { x: Box } //~ ERROR type uses owned - -fn main() { - let _x : Bar = Bar {x : box 10i}; //~ ERROR type uses owned - - box(GC) 2i; //~ ERROR type uses managed - - box 2i; //~ ERROR type uses owned - fn g(_: Box) {} //~ ERROR type uses owned - proc() {}; //~ ERROR type uses owned -} diff --git a/src/test/compile-fail/lint-managed-heap-memory.rs b/src/test/compile-fail/lint-managed-heap-memory.rs deleted file mode 100644 index 0a28242fb1b..00000000000 --- a/src/test/compile-fail/lint-managed-heap-memory.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(dead_code)] -#![forbid(managed_heap_memory)] - -use std::gc::{Gc, GC}; - -struct Foo { - x: Gc //~ ERROR type uses managed -} - -fn main() { - let _x : Foo = Foo {x : box(GC) 10}; - //~^ ERROR type uses managed -} diff --git a/src/test/compile-fail/new-box-syntax-bad.rs b/src/test/compile-fail/new-box-syntax-bad.rs deleted file mode 100644 index 602ffe2680b..00000000000 --- a/src/test/compile-fail/new-box-syntax-bad.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that the new `box` syntax works with unique pointers and GC pointers. - -use std::gc::{Gc, GC}; -use std::boxed::{Box, HEAP}; - -pub fn main() { - let x: Gc = box(HEAP) 2; //~ ERROR mismatched types - let y: Gc = box(HEAP)(1 + 2); //~ ERROR mismatched types - let z: Box = box(GC)(4 + 5); //~ ERROR mismatched types -} - diff --git a/src/test/compile-fail/no-send-res-ports.rs b/src/test/compile-fail/no-send-res-ports.rs index ddbfbc41eca..83dbd9ac1bf 100644 --- a/src/test/compile-fail/no-send-res-ports.rs +++ b/src/test/compile-fail/no-send-res-ports.rs @@ -10,14 +10,14 @@ #![feature(unsafe_destructor)] -extern crate debug; - use std::task; -use std::gc::{Gc, GC}; +use std::rc::Rc; -struct Port(Gc); +#[deriving(Show)] +struct Port(Rc); fn main() { + #[deriving(Show)] struct foo { _x: Port<()>, } @@ -33,11 +33,11 @@ fn foo(x: Port<()>) -> foo { } } - let x = foo(Port(box(GC) ())); + let x = foo(Port(Rc::new(()))); task::spawn(proc() { let y = x; //~^ ERROR `core::kinds::Send` is not implemented - println!("{:?}", y); + println!("{}", y); }); } diff --git a/src/test/compile-fail/occurs-check-2.rs b/src/test/compile-fail/occurs-check-2.rs index 69c012e0d8e..2765182225f 100644 --- a/src/test/compile-fail/occurs-check-2.rs +++ b/src/test/compile-fail/occurs-check-2.rs @@ -8,11 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::gc::GC; fn main() { let f; let g; g = f; - f = box(GC) g; //~ ERROR cyclic type of infinite size + f = box g; //~ ERROR cyclic type of infinite size } diff --git a/src/test/compile-fail/occurs-check.rs b/src/test/compile-fail/occurs-check.rs index a00528616c3..44318b36f4b 100644 --- a/src/test/compile-fail/occurs-check.rs +++ b/src/test/compile-fail/occurs-check.rs @@ -9,9 +9,7 @@ // except according to those terms. -use std::gc::GC; - fn main() { let f; - f = box(GC) f; //~ ERROR cyclic type of infinite size + f = box f; //~ ERROR cyclic type of infinite size } diff --git a/src/test/compile-fail/pinned-deep-copy.rs b/src/test/compile-fail/pinned-deep-copy.rs deleted file mode 100644 index 0e8bb40e0ff..00000000000 --- a/src/test/compile-fail/pinned-deep-copy.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(unsafe_destructor)] - -extern crate debug; - -use std::cell::Cell; -use std::gc::{Gc, GC}; - -struct r { - i: Gc>, -} - -#[unsafe_destructor] -impl Drop for r { - fn drop(&mut self) { - unsafe { - self.i.set(self.i.get() + 1); - } - } -} - -fn r(i: Gc>) -> r { - r { - i: i - } -} - -struct A { - y: r, -} - -fn main() { - let i = box(GC) Cell::new(0); - { - // Can't do this copy - let x = box box box A {y: r(i)}; - let _z = x.clone(); //~ ERROR not implemented - println!("{:?}", x); - } - println!("{:?}", *i); -} diff --git a/src/test/compile-fail/regions-appearance-constraint.rs b/src/test/compile-fail/regions-appearance-constraint.rs deleted file mode 100644 index 2c068052c54..00000000000 --- a/src/test/compile-fail/regions-appearance-constraint.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test no-special rooting is used for managed boxes - - -use std::gc::GC; - -fn testfn(cond: bool) { - let mut x = box(GC) 3i; - let mut y = box(GC) 4i; - - let mut a = &*x; - - let mut exp = 3i; - if cond { - a = &*y; - - exp = 4; - } - - x = box(GC) 5i; //~ERROR cannot assign to `x` because it is borrowed - y = box(GC) 6i; //~ERROR cannot assign to `y` because it is borrowed - assert_eq!(*a, exp); - assert_eq!(x, box(GC) 5i); - assert_eq!(y, box(GC) 6i); -} - -pub fn main() {} diff --git a/src/test/compile-fail/regions-infer-borrow-scope-too-big.rs b/src/test/compile-fail/regions-infer-borrow-scope-too-big.rs index fc513b91f89..b710578969b 100644 --- a/src/test/compile-fail/regions-infer-borrow-scope-too-big.rs +++ b/src/test/compile-fail/regions-infer-borrow-scope-too-big.rs @@ -9,8 +9,6 @@ // except according to those terms. -use std::gc::Gc; - struct point { x: int, y: int, @@ -20,7 +18,7 @@ fn x_coord<'r>(p: &'r point) -> &'r int { return &p.x; } -fn foo<'a>(p: Gc) -> &'a int { +fn foo<'a>(p: Box) -> &'a int { let xc = x_coord(&*p); //~ ERROR `*p` does not live long enough assert_eq!(*xc, 3); return xc; diff --git a/src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs b/src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs index 623b8e6319f..cf1fa2cfc4c 100644 --- a/src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs +++ b/src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs @@ -9,11 +9,9 @@ // except according to those terms. -use std::gc::Gc; - fn borrow(x: &T) -> &T {x} -fn foo(cond: || -> bool, make_box: || -> Gc) { +fn foo(cond: || -> bool, make_box: || -> Box) { let mut y: ∫ loop { let x = make_box(); diff --git a/src/test/compile-fail/regions-infer-paramd-indirect.rs b/src/test/compile-fail/regions-infer-paramd-indirect.rs index e862b36dcd1..f93907f5e5c 100644 --- a/src/test/compile-fail/regions-infer-paramd-indirect.rs +++ b/src/test/compile-fail/regions-infer-paramd-indirect.rs @@ -12,27 +12,25 @@ // Check that we correctly infer that b and c must be region // parameterized because they reference a which requires a region. -use std::gc::Gc; - type a<'a> = &'a int; -type b<'a> = Gc>; +type b<'a> = Box>; struct c<'a> { - f: Gc> + f: Box> } trait set_f<'a> { - fn set_f_ok(&mut self, b: Gc>); - fn set_f_bad(&mut self, b: Gc); + fn set_f_ok(&mut self, b: Box>); + fn set_f_bad(&mut self, b: Box); } impl<'a> set_f<'a> for c<'a> { - fn set_f_ok(&mut self, b: Gc>) { + fn set_f_ok(&mut self, b: Box>) { self.f = b; } - fn set_f_bad(&mut self, b: Gc) { - self.f = b; //~ ERROR mismatched types: expected `Gc>`, found `Gc>` + fn set_f_bad(&mut self, b: Box) { + self.f = b; //~ ERROR mismatched types: expected `Box>`, found `Box>` } } diff --git a/src/test/compile-fail/static-region-bound.rs b/src/test/compile-fail/static-region-bound.rs index 2cb1f462e1d..1e5a5ecc08e 100644 --- a/src/test/compile-fail/static-region-bound.rs +++ b/src/test/compile-fail/static-region-bound.rs @@ -9,12 +9,10 @@ // except according to those terms. -use std::gc::GC; - fn f(_: T) {} fn main() { - let x = box(GC) 3i; + let x = box 3i; f(x); let x = &3i; //~ ERROR borrowed value does not live long enough f(x); diff --git a/src/test/compile-fail/struct-field-assignability.rs b/src/test/compile-fail/struct-field-assignability.rs index 557341fd4f0..2c3d48e9bf7 100644 --- a/src/test/compile-fail/struct-field-assignability.rs +++ b/src/test/compile-fail/struct-field-assignability.rs @@ -11,13 +11,11 @@ // except according to those terms. -use std::gc::{Gc, GC}; - struct Foo<'a> { x: &'a int } pub fn main() { - let f = Foo { x: &*(box(GC) 3) }; //~ ERROR borrowed value does not live long enough + let f = Foo { x: &*(box 3) }; //~ ERROR borrowed value does not live long enough assert_eq!(*f.x, 3); } diff --git a/src/test/compile-fail/terr-sorts.rs b/src/test/compile-fail/terr-sorts.rs index 0817d7c610a..53ebe1f9b5b 100644 --- a/src/test/compile-fail/terr-sorts.rs +++ b/src/test/compile-fail/terr-sorts.rs @@ -9,18 +9,16 @@ // except according to those terms. -use std::gc::Gc; - struct foo { a: int, b: int, } -type bar = Gc; +type bar = Box; fn want_foo(f: foo) {} fn have_bar(b: bar) { - want_foo(b); //~ ERROR (expected struct foo, found Gc-ptr) + want_foo(b); //~ ERROR (expected struct foo, found box) } fn main() {} diff --git a/src/test/compile-fail/trait-impl-method-mismatch.rs b/src/test/compile-fail/trait-impl-method-mismatch.rs index bd844cc5860..73224c7b45c 100644 --- a/src/test/compile-fail/trait-impl-method-mismatch.rs +++ b/src/test/compile-fail/trait-impl-method-mismatch.rs @@ -9,15 +9,13 @@ // except according to those terms. -use std::gc::Gc; - trait Mumbo { - fn jumbo(&self, x: Gc) -> uint; + fn jumbo(&self, x: &uint) -> uint; } impl Mumbo for uint { // Cannot have a larger effect than the trait: - unsafe fn jumbo(&self, x: Gc) { *self + *x; } + unsafe fn jumbo(&self, x: &uint) { *self + *x; } //~^ ERROR expected normal fn, found unsafe fn } diff --git a/src/test/compile-fail/unique-unique-kind.rs b/src/test/compile-fail/unique-unique-kind.rs index 7d6cdaef85b..4c2805bf4bd 100644 --- a/src/test/compile-fail/unique-unique-kind.rs +++ b/src/test/compile-fail/unique-unique-kind.rs @@ -9,12 +9,12 @@ // except according to those terms. -use std::gc::GC; +use std::rc::Rc; fn f(_i: T) { } fn main() { - let i = box box(GC) 100i; + let i = box Rc::new(100i); f(i); //~ ERROR `core::kinds::Send` is not implemented } diff --git a/src/test/compile-fail/unique-vec-res.rs b/src/test/compile-fail/unique-vec-res.rs index 54b1fdea719..79f29c6b359 100644 --- a/src/test/compile-fail/unique-vec-res.rs +++ b/src/test/compile-fail/unique-vec-res.rs @@ -10,16 +10,15 @@ #![feature(unsafe_destructor)] -extern crate debug; use std::cell::Cell; -use std::gc::{Gc, GC}; -struct r { - i: Gc>, +#[deriving(Show)] +struct r<'a> { + i: &'a Cell, } #[unsafe_destructor] -impl Drop for r { +impl<'a> Drop for r<'a> { fn drop(&mut self) { unsafe { self.i.set(self.i.get() + 1); @@ -31,13 +30,13 @@ fn f(_i: Vec , _j: Vec ) { } fn main() { - let i1 = box(GC) Cell::new(0); - let i2 = box(GC) Cell::new(1); + let i1 = &Cell::new(0); + let i2 = &Cell::new(1); let r1 = vec!(box r { i: i1 }); let r2 = vec!(box r { i: i2 }); f(r1.clone(), r2.clone()); //~^ ERROR the trait `core::clone::Clone` is not implemented //~^^ ERROR the trait `core::clone::Clone` is not implemented - println!("{:?}", (r2, i1.get())); - println!("{:?}", (r1, i2.get())); + println!("{}", (r2, i1.get())); + println!("{}", (r1, i2.get())); } diff --git a/src/test/compile-fail/unsendable-class.rs b/src/test/compile-fail/unsendable-class.rs index c3fea8e86d4..102cb636550 100644 --- a/src/test/compile-fail/unsendable-class.rs +++ b/src/test/compile-fail/unsendable-class.rs @@ -12,14 +12,14 @@ // Test that a class with an unsendable field can't be // sent -use std::gc::{Gc, GC}; +use std::rc::Rc; struct foo { i: int, - j: Gc, + j: Rc, } -fn foo(i:int, j: Gc) -> foo { +fn foo(i:int, j: Rc) -> foo { foo { i: i, j: j @@ -29,5 +29,5 @@ fn foo(i:int, j: Gc) -> foo { fn main() { let cat = "kitty".to_string(); let (tx, _) = channel(); //~ ERROR `core::kinds::Send` is not implemented - tx.send(foo(42, box(GC) (cat))); //~ ERROR `core::kinds::Send` is not implemented + tx.send(foo(42, Rc::new(cat))); //~ ERROR `core::kinds::Send` is not implemented } diff --git a/src/test/debuginfo/borrowed-managed-basic.rs b/src/test/debuginfo/borrowed-managed-basic.rs deleted file mode 100644 index a2b8c54c380..00000000000 --- a/src/test/debuginfo/borrowed-managed-basic.rs +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-android: FIXME(#10381) - - -// Gdb doesn't know about UTF-32 character encoding and will print a rust char as only -// its numerical value. - -// compile-flags:-g - -// === GDB TESTS =================================================================================== - -// gdb-command:rbreak zzz -// gdb-command:run -// gdb-command:finish -// gdb-command:print *bool_ref -// gdb-check:$1 = true - -// gdb-command:print *int_ref -// gdb-check:$2 = -1 - -// gdb-command:print *char_ref -// gdb-check:$3 = 97 - -// gdb-command:print/d *i8_ref -// gdb-check:$4 = 68 - -// gdb-command:print *i16_ref -// gdb-check:$5 = -16 - -// gdb-command:print *i32_ref -// gdb-check:$6 = -32 - -// gdb-command:print *i64_ref -// gdb-check:$7 = -64 - -// gdb-command:print *uint_ref -// gdb-check:$8 = 1 - -// gdb-command:print/d *u8_ref -// gdb-check:$9 = 100 - -// gdb-command:print *u16_ref -// gdb-check:$10 = 16 - -// gdb-command:print *u32_ref -// gdb-check:$11 = 32 - -// gdb-command:print *u64_ref -// gdb-check:$12 = 64 - -// gdb-command:print *f32_ref -// gdb-check:$13 = 2.5 - -// gdb-command:print *f64_ref -// gdb-check:$14 = 3.5 - - -// === LLDB TESTS ================================================================================== - -// lldb-command:type format add -f decimal char -// lldb-command:type format add -f decimal 'unsigned char' -// lldb-command:run - -// lldb-command:print *bool_ref -// lldb-check:[...]$0 = true - -// lldb-command:print *int_ref -// lldb-check:[...]$1 = -1 - -// LLDB can't handle 32bit chars yet -// d ebugger:print *char_ref -// c heck:[...]$x = 97 - -// lldb-command:print *i8_ref -// lldb-check:[...]$2 = 68 - -// lldb-command:print *i16_ref -// lldb-check:[...]$3 = -16 - -// lldb-command:print *i32_ref -// lldb-check:[...]$4 = -32 - -// lldb-command:print *i64_ref -// lldb-check:[...]$5 = -64 - -// lldb-command:print *uint_ref -// lldb-check:[...]$6 = 1 - -// lldb-command:print *u8_ref -// lldb-check:[...]$7 = 100 - -// lldb-command:print *u16_ref -// lldb-check:[...]$8 = 16 - -// lldb-command:print *u32_ref -// lldb-check:[...]$9 = 32 - -// lldb-command:print *u64_ref -// lldb-check:[...]$10 = 64 - -// lldb-command:print *f32_ref -// lldb-check:[...]$11 = 2.5 - -// lldb-command:print *f64_ref -// lldb-check:[...]$12 = 3.5 - -#![allow(unused_variable)] - -use std::gc::{Gc, GC}; - -fn main() { - let bool_box: Gc = box(GC) true; - let bool_ref: &bool = &*bool_box; - - let int_box: Gc = box(GC) -1; - let int_ref: &int = &*int_box; - - let char_box: Gc = box(GC) 'a'; - let char_ref: &char = &*char_box; - - let i8_box: Gc = box(GC) 68; - let i8_ref: &i8 = &*i8_box; - - let i16_box: Gc = box(GC) -16; - let i16_ref: &i16 = &*i16_box; - - let i32_box: Gc = box(GC) -32; - let i32_ref: &i32 = &*i32_box; - - let i64_box: Gc = box(GC) -64; - let i64_ref: &i64 = &*i64_box; - - let uint_box: Gc = box(GC) 1; - let uint_ref: &uint = &*uint_box; - - let u8_box: Gc = box(GC) 100; - let u8_ref: &u8 = &*u8_box; - - let u16_box: Gc = box(GC) 16; - let u16_ref: &u16 = &*u16_box; - - let u32_box: Gc = box(GC) 32; - let u32_ref: &u32 = &*u32_box; - - let u64_box: Gc = box(GC) 64; - let u64_ref: &u64 = &*u64_box; - - let f32_box: Gc = box(GC) 2.5; - let f32_ref: &f32 = &*f32_box; - - let f64_box: Gc = box(GC) 3.5; - let f64_ref: &f64 = &*f64_box; - - zzz(); // #break -} - -fn zzz() {()} diff --git a/src/test/debuginfo/borrowed-struct.rs b/src/test/debuginfo/borrowed-struct.rs index 02131734fb1..8b9c790bbbf 100644 --- a/src/test/debuginfo/borrowed-struct.rs +++ b/src/test/debuginfo/borrowed-struct.rs @@ -29,15 +29,6 @@ // gdb-command:print *ref_to_unnamed // gdb-check:$4 = {x = 11, y = 24.5} -// gdb-command:print *managed_val_ref -// gdb-check:$5 = {x = 12, y = 25.5} - -// gdb-command:print *managed_val_interior_ref_1 -// gdb-check:$6 = 12 - -// gdb-command:print *managed_val_interior_ref_2 -// gdb-check:$7 = 25.5 - // gdb-command:print *unique_val_ref // gdb-check:$8 = {x = 13, y = 26.5} @@ -64,15 +55,6 @@ // lldb-command:print *ref_to_unnamed // lldb-check:[...]$3 = SomeStruct { x: 11, y: 24.5 } -// lldb-command:print *managed_val_ref -// lldb-check:[...]$4 = SomeStruct { x: 12, y: 25.5 } - -// lldb-command:print *managed_val_interior_ref_1 -// lldb-check:[...]$5 = 12 - -// lldb-command:print *managed_val_interior_ref_2 -// lldb-check:[...]$6 = 25.5 - // lldb-command:print *unique_val_ref // lldb-check:[...]$7 = SomeStruct { x: 13, y: 26.5 } @@ -84,8 +66,6 @@ #![allow(unused_variable)] -use std::gc::GC; - struct SomeStruct { x: int, y: f64 @@ -98,11 +78,6 @@ fn main() { let stack_val_interior_ref_2: &f64 = &stack_val.y; let ref_to_unnamed: &SomeStruct = &SomeStruct { x: 11, y: 24.5 }; - let managed_val = box(GC) SomeStruct { x: 12, y: 25.5 }; - let managed_val_ref: &SomeStruct = &*managed_val; - let managed_val_interior_ref_1: &int = &managed_val.x; - let managed_val_interior_ref_2: &f64 = &managed_val.y; - let unique_val = box SomeStruct { x: 13, y: 26.5 }; let unique_val_ref: &SomeStruct = &*unique_val; let unique_val_interior_ref_1: &int = &unique_val.x; diff --git a/src/test/debuginfo/borrowed-tuple.rs b/src/test/debuginfo/borrowed-tuple.rs index 55530636571..2c78d14a86c 100644 --- a/src/test/debuginfo/borrowed-tuple.rs +++ b/src/test/debuginfo/borrowed-tuple.rs @@ -25,9 +25,6 @@ // gdb-command:print *ref_to_unnamed // gdb-check:$2 = {-15, -20} -// gdb-command:print *managed_val_ref -// gdb-check:$3 = {-16, -21} - // gdb-command:print *unique_val_ref // gdb-check:$4 = {-17, -22} @@ -42,25 +39,17 @@ // lldb-command:print *ref_to_unnamed // lldb-check:[...]$1 = (-15, -20) -// lldb-command:print *managed_val_ref -// lldb-check:[...]$2 = (-16, -21) - // lldb-command:print *unique_val_ref // lldb-check:[...]$3 = (-17, -22) #![allow(unused_variable)] -use std::gc::{Gc, GC}; - fn main() { let stack_val: (i16, f32) = (-14, -19f32); let stack_val_ref: &(i16, f32) = &stack_val; let ref_to_unnamed: &(i16, f32) = &(-15, -20f32); - let managed_val: Gc<(i16, f32)> = box(GC) (-16, -21f32); - let managed_val_ref: &(i16, f32) = &*managed_val; - let unique_val: Box<(i16, f32)> = box() (-17, -22f32); let unique_val_ref: &(i16, f32) = &*unique_val; diff --git a/src/test/debuginfo/box.rs b/src/test/debuginfo/box.rs index 1a07f614c14..c459b9be3d0 100644 --- a/src/test/debuginfo/box.rs +++ b/src/test/debuginfo/box.rs @@ -22,10 +22,6 @@ // gdb-check:$1 = 1 // gdb-command:print *b // gdb-check:$2 = {2, 3.5} -// gdb-command:print c->val -// gdb-check:$3 = 4 -// gdb-command:print d->val -// gdb-check:$4 = false // === LLDB TESTS ================================================================================== @@ -35,20 +31,12 @@ // lldb-check:[...]$0 = 1 // lldb-command:print *b // lldb-check:[...]$1 = (2, 3.5) -// lldb-command:print c->val -// lldb-check:[...]$2 = 4 -// lldb-command:print d->val -// lldb-check:[...]$3 = false #![allow(unused_variable)] -use std::gc::GC; - fn main() { let a = box 1i; let b = box() (2i, 3.5f64); - let c = box(GC) 4i; - let d = box(GC) false; zzz(); // #break } diff --git a/src/test/debuginfo/boxed-struct.rs b/src/test/debuginfo/boxed-struct.rs index d3a556e4009..a22b9fdea5c 100644 --- a/src/test/debuginfo/boxed-struct.rs +++ b/src/test/debuginfo/boxed-struct.rs @@ -21,15 +21,9 @@ // gdb-command:print *unique // gdb-check:$1 = {x = 99, y = 999, z = 9999, w = 99999} -// gdb-command:print managed->val -// gdb-check:$2 = {x = 88, y = 888, z = 8888, w = 88888} - // gdb-command:print *unique_dtor // gdb-check:$3 = {x = 77, y = 777, z = 7777, w = 77777} -// gdb-command:print managed_dtor->val -// gdb-check:$4 = {x = 33, y = 333, z = 3333, w = 33333} - // === LLDB TESTS ================================================================================== @@ -38,19 +32,11 @@ // lldb-command:print *unique // lldb-check:[...]$0 = StructWithSomePadding { x: 99, y: 999, z: 9999, w: 99999 } -// lldb-command:print managed->val -// lldb-check:[...]$1 = StructWithSomePadding { x: 88, y: 888, z: 8888, w: 88888 } - // lldb-command:print *unique_dtor // lldb-check:[...]$2 = StructWithDestructor { x: 77, y: 777, z: 7777, w: 77777 } -// lldb-command:print managed_dtor->val -// lldb-check:[...]$3 = StructWithDestructor { x: 33, y: 333, z: 3333, w: 33333 } - #![allow(unused_variable)] -use std::gc::GC; - struct StructWithSomePadding { x: i16, y: i32, @@ -72,11 +58,8 @@ fn drop(&mut self) {} fn main() { let unique = box StructWithSomePadding { x: 99, y: 999, z: 9999, w: 99999 }; - let managed = box(GC) StructWithSomePadding { x: 88, y: 888, z: 8888, w: 88888 }; let unique_dtor = box StructWithDestructor { x: 77, y: 777, z: 7777, w: 77777 }; - let managed_dtor = box(GC) StructWithDestructor { x: 33, y: 333, z: 3333, w: 33333 }; - zzz(); // #break } diff --git a/src/test/debuginfo/by-value-self-argument-in-trait-impl.rs b/src/test/debuginfo/by-value-self-argument-in-trait-impl.rs index af1b38adf80..11df00ee4fe 100644 --- a/src/test/debuginfo/by-value-self-argument-in-trait-impl.rs +++ b/src/test/debuginfo/by-value-self-argument-in-trait-impl.rs @@ -33,11 +33,6 @@ // gdb-check:$3 = {4444.5, 5555, 6666, 7777.5} // gdb-command:continue -// gdb-command:finish -// gdb-command:print self->val -// gdb-check:$4 = 8888 -// gdb-command:continue - // === LLDB TESTS ================================================================================== @@ -55,12 +50,6 @@ // lldb-check:[...]$2 = (4444.5, 5555, 6666, 7777.5) // lldb-command:continue -// lldb-command:print self->val -// lldb-check:[...]$3 = 8888 -// lldb-command:continue - -use std::gc::{Gc, GC}; - trait Trait { fn method(self) -> Self; } @@ -91,18 +80,10 @@ fn method(self) -> (f64, int, int, f64) { } } -impl Trait for Gc { - fn method(self) -> Gc { - zzz(); // #break - self - } -} - fn main() { let _ = (1111 as int).method(); let _ = Struct { x: 2222, y: 3333 }.method(); let _ = (4444.5, 5555, 6666, 7777.5).method(); - let _ = (box(GC) 8888).method(); } fn zzz() { () } diff --git a/src/test/debuginfo/managed-enum.rs b/src/test/debuginfo/managed-enum.rs deleted file mode 100644 index e5da4d2cdb1..00000000000 --- a/src/test/debuginfo/managed-enum.rs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-android: FIXME(#10381) - -// compile-flags:-g - -// === GDB TESTS =================================================================================== - -// gdb-command:rbreak zzz -// gdb-command:run -// gdb-command:finish - -// gdb-command:print the_a->val -// gdb-check:$1 = {{TheA, x = 0, y = 8970181431921507452}, {TheA, 0, 2088533116, 2088533116}} - -// gdb-command:print the_b->val -// gdb-check:$2 = {{TheB, x = 0, y = 1229782938247303441}, {TheB, 0, 286331153, 286331153}} - -// gdb-command:print univariant->val -// gdb-check:$3 = {{-9747455}} - - -// === LLDB TESTS ================================================================================== - -// lldb-command:run - -// lldb-command:print the_a->val -// lldb-check:[...]$0 = TheA { x: 0, y: 8970181431921507452 } - -// lldb-command:print the_b->val -// lldb-check:[...]$1 = TheB(0, 286331153, 286331153) - -// lldb-command:print univariant->val -// lldb-check:[...]$2 = TheOnlyCase(-9747455) - -#![allow(unused_variable)] -#![feature(struct_variant)] - -use std::gc::GC; - -// The first element is to ensure proper alignment, irrespective of the machines word size. Since -// the size of the discriminant value is machine dependent, this has be taken into account when -// datatype layout should be predictable as in this case. -enum ABC { - TheA { x: i64, y: i64 }, - TheB (i64, i32, i32), -} - -// This is a special case since it does not have the implicit discriminant field. -enum Univariant { - TheOnlyCase(i64) -} - -fn main() { - - // In order to avoid endianess trouble all of the following test values consist of a single - // repeated byte. This way each interpretation of the union should look the same, no matter if - // this is a big or little endian machine. - - // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452 - // 0b01111100011111000111110001111100 = 2088533116 - // 0b0111110001111100 = 31868 - // 0b01111100 = 124 - let the_a = box(GC) TheA { x: 0, y: 8970181431921507452 }; - - // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441 - // 0b00010001000100010001000100010001 = 286331153 - // 0b0001000100010001 = 4369 - // 0b00010001 = 17 - let the_b = box(GC) TheB (0, 286331153, 286331153); - - let univariant = box(GC) TheOnlyCase(-9747455); - - zzz(); // #break -} - -fn zzz() {()} diff --git a/src/test/debuginfo/managed-pointer-within-unique-vec.rs b/src/test/debuginfo/managed-pointer-within-unique-vec.rs deleted file mode 100644 index 69f3938ecee..00000000000 --- a/src/test/debuginfo/managed-pointer-within-unique-vec.rs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-android: FIXME(#10381) - - -// compile-flags:-g - -// === GDB TESTS =================================================================================== - -// gdb-command:rbreak zzz -// gdb-command:run -// gdb-command:finish - -// gdb-command:print unique.ptr[0]->val -// gdb-check:$1 = 10 - -// gdb-command:print unique.ptr[1]->val -// gdb-check:$2 = 11 - -// gdb-command:print unique.ptr[2]->val -// gdb-check:$3 = 12 - -// gdb-command:print unique.ptr[3]->val -// gdb-check:$4 = 13 - - -// === LLDB TESTS ================================================================================== - -// lldb-command:run - -// lldb-command:print unique.ptr[0]->val -// lldb-check:[...]$0 = 10 - -// lldb-command:print unique.ptr[1]->val -// lldb-check:[...]$1 = 11 - -// lldb-command:print unique.ptr[2]->val -// lldb-check:[...]$2 = 12 - -// lldb-command:print unique.ptr[3]->val -// lldb-check:[...]$3 = 13 - - -#![allow(unused_variable)] - -use std::gc::{Gc, GC}; - -fn main() { - - let unique: Vec> = vec!(box(GC) 10, box(GC) 11, box(GC) 12, box(GC) 13); - - zzz(); // #break -} - -fn zzz() {()} diff --git a/src/test/debuginfo/managed-pointer-within-unique.rs b/src/test/debuginfo/managed-pointer-within-unique.rs deleted file mode 100644 index 2690efb8f85..00000000000 --- a/src/test/debuginfo/managed-pointer-within-unique.rs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-android: FIXME(#10381) - - -// compile-flags:-g - -// === GDB TESTS =================================================================================== - -// gdb-command:set print pretty off -// gdb-command:rbreak zzz -// gdb-command:run -// gdb-command:finish - -// gdb-command:print *ordinary_unique -// gdb-check:$1 = {-1, -2} - -// gdb-command:print managed_within_unique->x -// gdb-check:$2 = -3 - -// gdb-command:print managed_within_unique->y->val -// gdb-check:$3 = -4 - -// === LLDB TESTS ================================================================================== - -// lldb-command:run - -// lldb-command:print *ordinary_unique -// lldb-check:[...]$0 = (-1, -2) - -// lldb-command:print managed_within_unique->x -// lldb-check:[...]$1 = -3 - -// lldb-command:print managed_within_unique->y->val -// lldb-check:[...]$2 = -4 - -#![allow(unused_variable)] - -use std::gc::{GC, Gc}; - -struct ContainsManaged { - x: int, - y: Gc, -} - -fn main() { - let ordinary_unique = box() (-1i, -2i); - - let managed_within_unique = box ContainsManaged { x: -3, y: box(GC) -4i }; - - zzz(); // #break -} - -fn zzz() {()} diff --git a/src/test/debuginfo/recursive-struct.rs b/src/test/debuginfo/recursive-struct.rs index 76722b743d7..412bdfaaf15 100644 --- a/src/test/debuginfo/recursive-struct.rs +++ b/src/test/debuginfo/recursive-struct.rs @@ -29,11 +29,6 @@ // gdb-command:print unique_unique->next.RUST$ENCODED$ENUM$0$Empty.val->value // gdb-check:$4 = 3 -// gdb-command:print box_unique->val.value -// gdb-check:$5 = 4 -// gdb-command:print box_unique->val.next.RUST$ENCODED$ENUM$0$Empty.val->value -// gdb-check:$6 = 5 - // gdb-command:print vec_unique[0].value // gdb-check:$7 = 6.5 // gdb-command:print vec_unique[0].next.RUST$ENCODED$ENUM$0$Empty.val->value @@ -44,32 +39,6 @@ // gdb-command:print borrowed_unique->next.RUST$ENCODED$ENUM$0$Empty.val->value // gdb-check:$10 = 9.5 -// MANAGED -// gdb-command:print stack_managed.value -// gdb-check:$11 = 10 -// gdb-command:print stack_managed.next.RUST$ENCODED$ENUM$0$Empty.val->val.value -// gdb-check:$12 = 11 - -// gdb-command:print unique_managed->value -// gdb-check:$13 = 12 -// gdb-command:print unique_managed->next.RUST$ENCODED$ENUM$0$Empty.val->val.value -// gdb-check:$14 = 13 - -// gdb-command:print box_managed.val->value -// gdb-check:$15 = 14 -// gdb-command:print box_managed->val->next.RUST$ENCODED$ENUM$0$Empty.val->val.value -// gdb-check:$16 = 15 - -// gdb-command:print vec_managed[0].value -// gdb-check:$17 = 16.5 -// gdb-command:print vec_managed[0].next.RUST$ENCODED$ENUM$0$Empty.val->val.value -// gdb-check:$18 = 17.5 - -// gdb-command:print borrowed_managed->value -// gdb-check:$19 = 18.5 -// gdb-command:print borrowed_managed->next.RUST$ENCODED$ENUM$0$Empty.val->val.value -// gdb-check:$20 = 19.5 - // LONG CYCLE // gdb-command:print long_cycle1.value // gdb-check:$21 = 20 @@ -106,8 +75,6 @@ #![allow(unused_variable)] #![feature(struct_variant)] -use std::gc::{Gc, GC}; - enum Opt { Empty, Val { val: T } @@ -118,11 +85,6 @@ struct UniqueNode { value: T } -struct ManagedNode { - next: Opt>>, - value: T -} - struct LongCycle1 { next: Box>, value: T, @@ -184,16 +146,6 @@ fn main() { value: 2, }; - let box_unique: Gc> = box(GC) UniqueNode { - next: Val { - val: box UniqueNode { - next: Empty, - value: 5, - } - }, - value: 4, - }; - let vec_unique: [UniqueNode, ..1] = [UniqueNode { next: Val { val: box UniqueNode { @@ -214,56 +166,6 @@ fn main() { value: 8.5, }; - let stack_managed: ManagedNode = ManagedNode { - next: Val { - val: box(GC) ManagedNode { - next: Empty, - value: 11, - } - }, - value: 10, - }; - - let unique_managed: Box> = box ManagedNode { - next: Val { - val: box(GC) ManagedNode { - next: Empty, - value: 13, - } - }, - value: 12, - }; - - let box_managed: Gc> = box(GC) ManagedNode { - next: Val { - val: box(GC) ManagedNode { - next: Empty, - value: 15, - } - }, - value: 14, - }; - - let vec_managed: [ManagedNode, ..1] = [ManagedNode { - next: Val { - val: box(GC) ManagedNode { - next: Empty, - value: 17.5, - } - }, - value: 16.5, - }]; - - let borrowed_managed: &ManagedNode = &ManagedNode { - next: Val { - val: box(GC) ManagedNode { - next: Empty, - value: 19.5, - } - }, - value: 18.5, - }; - // LONG CYCLE let long_cycle1: LongCycle1 = LongCycle1 { next: box LongCycle2 { diff --git a/src/test/debuginfo/var-captured-in-nested-closure.rs b/src/test/debuginfo/var-captured-in-nested-closure.rs index a08cc6bdb6e..89415df3588 100644 --- a/src/test/debuginfo/var-captured-in-nested-closure.rs +++ b/src/test/debuginfo/var-captured-in-nested-closure.rs @@ -28,8 +28,6 @@ // gdb-check:$4 = {a = -3, b = 4.5, c = 5} // gdb-command:print *owned // gdb-check:$5 = 6 -// gdb-command:print managed->val -// gdb-check:$6 = 7 // gdb-command:print closure_local // gdb-check:$7 = 8 // gdb-command:continue @@ -45,8 +43,6 @@ // gdb-check:$11 = {a = -3, b = 4.5, c = 5} // gdb-command:print *owned // gdb-check:$12 = 6 -// gdb-command:print managed->val -// gdb-check:$13 = 7 // gdb-command:print closure_local // gdb-check:$14 = 8 // gdb-command:continue @@ -66,8 +62,6 @@ // lldb-check:[...]$3 = Struct { a: -3, b: 4.5, c: 5 } // lldb-command:print *owned // lldb-check:[...]$4 = 6 -// lldb-command:print managed->val -// lldb-check:[...]$5 = 7 // lldb-command:print closure_local // lldb-check:[...]$6 = 8 // lldb-command:continue @@ -82,16 +76,12 @@ // lldb-check:[...]$10 = Struct { a: -3, b: 4.5, c: 5 } // lldb-command:print *owned // lldb-check:[...]$11 = 6 -// lldb-command:print managed->val -// lldb-check:[...]$12 = 7 // lldb-command:print closure_local // lldb-check:[...]$13 = 8 // lldb-command:continue #![allow(unused_variable)] -use std::gc::GC; - struct Struct { a: int, b: f64, @@ -110,14 +100,13 @@ fn main() { let struct_ref = &a_struct; let owned = box 6; - let managed = box(GC) 7; let closure = || { let closure_local = 8; let nested_closure = || { zzz(); // #break - variable = constant + a_struct.a + struct_ref.a + *owned + *managed + closure_local; + variable = constant + a_struct.a + struct_ref.a + *owned + closure_local; }; zzz(); // #break diff --git a/src/test/debuginfo/var-captured-in-stack-closure.rs b/src/test/debuginfo/var-captured-in-stack-closure.rs index c37f0ddbe99..8ea407fc544 100644 --- a/src/test/debuginfo/var-captured-in-stack-closure.rs +++ b/src/test/debuginfo/var-captured-in-stack-closure.rs @@ -28,8 +28,6 @@ // gdb-check:$4 = {a = -3, b = 4.5, c = 5} // gdb-command:print *owned // gdb-check:$5 = 6 -// gdb-command:print managed->val -// gdb-check:$6 = 7 // === LLDB TESTS ================================================================================== @@ -46,13 +44,9 @@ // lldb-check:[...]$3 = Struct { a: -3, b: 4.5, c: 5 } // lldb-command:print *owned // lldb-check:[...]$4 = 6 -// lldb-command:print managed->val -// lldb-check:[...]$5 = 7 #![allow(unused_variable)] -use std::gc::GC; - struct Struct { a: int, b: f64, @@ -71,11 +65,10 @@ fn main() { let struct_ref = &a_struct; let owned = box 6; - let managed = box(GC) 7; let closure = || { zzz(); // #break - variable = constant + a_struct.a + struct_ref.a + *owned + *managed; + variable = constant + a_struct.a + struct_ref.a + *owned; }; closure(); diff --git a/src/test/pretty/block-disambig.rs b/src/test/pretty/block-disambig.rs index 3f6d5b8c18a..01fc70c1d2c 100644 --- a/src/test/pretty/block-disambig.rs +++ b/src/test/pretty/block-disambig.rs @@ -14,34 +14,33 @@ use std::cell::Cell; -use std::gc::GC; -fn test1() { let val = box(GC) 0i; { } *val; } +fn test1() { let val = &0i; { } *val; } -fn test2() -> int { let val = box(GC) 0i; { } *val } +fn test2() -> int { let val = &0i; { } *val } struct S { eax: int } fn test3() { - let regs = box(GC) Cell::new(S {eax: 0}); + let regs = &Cell::new(S {eax: 0}); match true { true => { } _ => { } } regs.set(S {eax: 1}); } -fn test4() -> bool { let regs = box(GC) true; if true { } *regs || false } +fn test4() -> bool { let regs = &true; if true { } *regs || false } fn test5() -> (int, int) { { } (0, 1) } fn test6() -> bool { { } (true || false) && true } fn test7() -> uint { - let regs = box(GC) 0i; + let regs = &0i; match true { true => { } _ => { } } (*regs < 2) as uint } fn test8() -> int { - let val = box(GC) 0i; + let val = &0i; match true { true => { } _ => { } @@ -54,12 +53,12 @@ fn test8() -> int { } fn test9() { - let regs = box(GC) Cell::new(0i); + let regs = &Cell::new(0i); match true { true => { } _ => { } } regs.set(regs.get() + 1); } fn test10() -> int { - let regs = box(GC) vec!(0i); + let regs = vec!(0i); match true { true => { } _ => { } } *(*regs).get(0) } diff --git a/src/test/run-fail/args-fail.rs b/src/test/run-fail/args-fail.rs index d8ba7e1b788..5e1b7bb69bb 100644 --- a/src/test/run-fail/args-fail.rs +++ b/src/test/run-fail/args-fail.rs @@ -11,8 +11,6 @@ // error-pattern:meep -use std::gc::{Gc, GC}; +fn f(_a: int, _b: int, _c: Box) { fail!("moop"); } -fn f(_a: int, _b: int, _c: Gc) { fail!("moop"); } - -fn main() { f(1, fail!("meep"), box(GC) 42); } +fn main() { f(1, fail!("meep"), box 42); } diff --git a/src/test/run-fail/issue-2272.rs b/src/test/run-fail/issue-2272.rs deleted file mode 100644 index 87de4d3d3f2..00000000000 --- a/src/test/run-fail/issue-2272.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -// error-pattern:explicit failure -// Issue #2272 - unwind this without leaking the unique pointer - -use std::gc::{Gc, GC}; - -struct X { y: Y, a: Box } - -struct Y { z: Gc } - -fn main() { - let _x = X { - y: Y { - z: box(GC) 0 - }, - a: box 0 - }; - fail!(); -} diff --git a/src/test/run-fail/unwind-assert.rs b/src/test/run-fail/unwind-assert.rs deleted file mode 100644 index 4947093d10c..00000000000 --- a/src/test/run-fail/unwind-assert.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:fail - - -use std::gc::GC; - -fn main() { - let _a = box(GC) 0i; - assert!(false); -} diff --git a/src/test/run-fail/unwind-box-fn-unique.rs b/src/test/run-fail/unwind-box-fn-unique.rs deleted file mode 100644 index 7ed58be6072..00000000000 --- a/src/test/run-fail/unwind-box-fn-unique.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -// error-pattern:fail - -extern crate debug; - -use std::gc::{GC, Gc}; - -fn failfn() { - fail!(); -} - -fn main() { - let y = box 0i; - let x: Gc = box(GC) (proc() { - println!("{:?}", y.clone()); - }); - failfn(); - println!("{:?}", x); -} diff --git a/src/test/run-fail/unwind-box-res.rs b/src/test/run-fail/unwind-box-res.rs deleted file mode 100644 index ede83311732..00000000000 --- a/src/test/run-fail/unwind-box-res.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:fail - - -extern crate debug; - -use std::mem; -use std::gc::GC; - -fn failfn() { - fail!(); -} - -struct r { - v: *const int, -} - -impl Drop for r { - fn drop(&mut self) { - unsafe { - let _v2: Box = mem::transmute(self.v); - } - } -} - -fn r(v: *const int) -> r { - r { - v: v - } -} - -fn main() { - unsafe { - let i1 = box 0i; - let i1p = mem::transmute_copy(&i1); - mem::forget(i1); - let x = box(GC) r(i1p); - failfn(); - println!("{:?}", x); - } -} diff --git a/src/test/run-fail/unwind-box-str.rs b/src/test/run-fail/unwind-box-str.rs deleted file mode 100644 index 07a8f5d4cfa..00000000000 --- a/src/test/run-fail/unwind-box-str.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:fail - - -extern crate debug; - -use std::gc::GC; - -fn failfn() { - fail!(); -} - -fn main() { - let x = box(GC) "hi".to_string(); - failfn(); - println!("{:?}", x); -} diff --git a/src/test/run-fail/unwind-box-unique-unique.rs b/src/test/run-fail/unwind-box-unique-unique.rs deleted file mode 100644 index 9aa916a062e..00000000000 --- a/src/test/run-fail/unwind-box-unique-unique.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:fail - - -extern crate debug; - -use std::gc::GC; - -fn failfn() { - fail!(); -} - -fn main() { - let x = box(GC) box box 0i; - failfn(); - println!("{:?}", x); -} diff --git a/src/test/run-fail/unwind-box-unique.rs b/src/test/run-fail/unwind-box-unique.rs deleted file mode 100644 index 7135742db34..00000000000 --- a/src/test/run-fail/unwind-box-unique.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:fail - - -extern crate debug; - -use std::gc::GC; - -fn failfn() { - fail!(); -} - -fn main() { - let x = box(GC) box 0i; - failfn(); - println!("{:?}", x); -} diff --git a/src/test/run-fail/unwind-box-vec.rs b/src/test/run-fail/unwind-box-vec.rs deleted file mode 100644 index e7d1476c2b6..00000000000 --- a/src/test/run-fail/unwind-box-vec.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:fail - - -extern crate debug; - -use std::gc::GC; - -fn failfn() { - fail!(); -} - -fn main() { - let x = box(GC) vec!(0i, 1, 2, 3, 4, 5); - failfn(); - println!("{:?}", x); -} diff --git a/src/test/run-fail/unwind-box.rs b/src/test/run-fail/unwind-box.rs deleted file mode 100644 index 7d93ae56156..00000000000 --- a/src/test/run-fail/unwind-box.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:fail - - -use std::gc::GC; - -fn failfn() { - fail!(); -} - -fn main() { - box(GC) 0i; - failfn(); -} diff --git a/src/test/run-fail/unwind-fail.rs b/src/test/run-fail/unwind-fail.rs deleted file mode 100644 index 1e19522871a..00000000000 --- a/src/test/run-fail/unwind-fail.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:fail - - -use std::gc::GC; - -fn main() { - box(GC) 0i; - fail!(); -} diff --git a/src/test/run-fail/unwind-initializer-indirect.rs b/src/test/run-fail/unwind-initializer-indirect.rs deleted file mode 100644 index 13ad5d2fae3..00000000000 --- a/src/test/run-fail/unwind-initializer-indirect.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:fail - - -use std::gc::Gc; - -fn f() -> Gc { fail!(); } - -fn main() { - let _a: Gc = f(); -} diff --git a/src/test/run-fail/unwind-initializer.rs b/src/test/run-fail/unwind-initializer.rs deleted file mode 100644 index 7294b19ac9a..00000000000 --- a/src/test/run-fail/unwind-initializer.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:fail - - -use std::gc::Gc; - -fn main() { - let _a: Gc = { - fail!(); - }; -} diff --git a/src/test/run-fail/unwind-iter.rs b/src/test/run-fail/unwind-iter.rs deleted file mode 100644 index 411b9a56a2f..00000000000 --- a/src/test/run-fail/unwind-iter.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:fail - -#![allow(unreachable_code)] -#![allow(unused_variable)] - -use std::gc::GC; - -fn x(it: |int|) { - fail!(); - it(0); -} - -fn main() { - let a = box(GC) 0i; - x(|_i| { } ); -} diff --git a/src/test/run-fail/unwind-iter2.rs b/src/test/run-fail/unwind-iter2.rs deleted file mode 100644 index 1a2492e0ac8..00000000000 --- a/src/test/run-fail/unwind-iter2.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:fail - - -use std::gc::{GC}; - -fn x(it: |int|) { - let _a = box(GC) 0i; - it(1); -} - -fn main() { - x(|_x| fail!() ); -} diff --git a/src/test/run-fail/unwind-lambda.rs b/src/test/run-fail/unwind-lambda.rs deleted file mode 100644 index e96bc14905e..00000000000 --- a/src/test/run-fail/unwind-lambda.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:fail - - -use std::gc::{Gc, GC}; - -fn main() { - let cheese = "roquefort".to_string(); - let carrots = box(GC) "crunchy".to_string(); - - let result: |Gc, |String||: 'static = (|tasties, macerate| { - macerate((*tasties).clone()); - }); - result(carrots, |food| { - let mush = format!("{}{}", food, cheese); - let cheese = cheese.clone(); - let f: || = || { - let _chew = format!("{}{}", mush, cheese); - fail!("so yummy") - }; - f(); - }); -} diff --git a/src/test/run-fail/unwind-match.rs b/src/test/run-fail/unwind-match.rs deleted file mode 100644 index a6564a68e19..00000000000 --- a/src/test/run-fail/unwind-match.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Issue #945 -// error-pattern:non-exhaustive match failure - - -use std::gc::GC; - -fn test_box() { - box(GC) 0i; -} -fn test_str() { - let res = match false { true => { "happy".to_string() }, - _ => fail!("non-exhaustive match failure") }; - assert_eq!(res, "happy".to_string()); -} -fn main() { - test_box(); - test_str(); -} diff --git a/src/test/run-fail/unwind-misc-1.rs b/src/test/run-fail/unwind-misc-1.rs deleted file mode 100644 index 23ec6cd0300..00000000000 --- a/src/test/run-fail/unwind-misc-1.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// exec-env:RUST_NEWRT=1 -// error-pattern:fail - - -use std::vec; -use std::collections; -use std::gc::GC; - -fn main() { - let _count = box(GC) 0u; - let mut map = collections::HashMap::new(); - let mut arr = Vec::new(); - for _i in range(0u, 10u) { - arr.push(box(GC) "key stuff".to_string()); - map.insert(arr.clone(), - arr.clone().append([box(GC) "value stuff".to_string()])); - if arr.len() == 5 { - fail!(); - } - } -} diff --git a/src/test/run-fail/unwind-move.rs b/src/test/run-fail/unwind-move.rs deleted file mode 100644 index 692bf713b40..00000000000 --- a/src/test/run-fail/unwind-move.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:fail - - -use std::gc::{Gc, GC}; - -fn f(_a: Gc) { - fail!(); -} - -fn main() { - let a = box(GC) 0; - f(a); -} diff --git a/src/test/run-fail/unwind-nested.rs b/src/test/run-fail/unwind-nested.rs deleted file mode 100644 index 84b727ea20f..00000000000 --- a/src/test/run-fail/unwind-nested.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:fail - - -use std::gc::GC; - -fn main() { - let _a = box(GC) 0i; - { - let _b = box(GC) 0i; - { - fail!(); - } - } -} diff --git a/src/test/run-fail/unwind-partial-box.rs b/src/test/run-fail/unwind-partial-box.rs deleted file mode 100644 index 366531b9127..00000000000 --- a/src/test/run-fail/unwind-partial-box.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:fail - - -use std::gc::GC; - -fn f() -> Vec { fail!(); } - -// Voodoo. In unwind-alt we had to do this to trigger the bug. Might -// have been to do with memory allocation patterns. -fn prime() { - box(GC) 0i; -} - -fn partial() { - let _x = box(GC) f(); -} - -fn main() { - prime(); - partial(); -} diff --git a/src/test/run-fail/unwind-partial-unique.rs b/src/test/run-fail/unwind-partial-unique.rs deleted file mode 100644 index 725b57af7df..00000000000 --- a/src/test/run-fail/unwind-partial-unique.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:fail - - -use std::gc::GC; - -fn f() -> Vec { fail!(); } - -// Voodoo. In unwind-alt we had to do this to trigger the bug. Might -// have been to do with memory allocation patterns. -fn prime() { - box(GC) 0i; -} - -fn partial() { - let _x = box f(); -} - -fn main() { - prime(); - partial(); -} diff --git a/src/test/run-fail/unwind-partial-vec.rs b/src/test/run-fail/unwind-partial-vec.rs deleted file mode 100644 index 627fb3d028e..00000000000 --- a/src/test/run-fail/unwind-partial-vec.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:fail - - -use std::gc::GC; - -fn f() -> Vec { fail!(); } - -// Voodoo. In unwind-alt we had to do this to trigger the bug. Might -// have been to do with memory allocation patterns. -fn prime() { - box(GC) 0i; -} - -fn partial() { - let _x = vec!(vec!(0i), f(), vec!(0i)); -} - -fn main() { - prime(); - partial(); -} diff --git a/src/test/run-fail/unwind-resource-fail.rs b/src/test/run-fail/unwind-resource-fail.rs deleted file mode 100644 index 66fd044d64e..00000000000 --- a/src/test/run-fail/unwind-resource-fail.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -// error-pattern:squirrel - -use std::gc::GC; - -struct r { - i: int, -} - -impl Drop for r { - fn drop(&mut self) { fail!("squirrel") } -} - -fn r(i: int) -> r { r { i: i } } - -fn main() { - box(GC) 0i; - let _r = r(0); -} diff --git a/src/test/run-fail/unwind-resource-fail2.rs b/src/test/run-fail/unwind-resource-fail2.rs deleted file mode 100644 index add7fe3f0f3..00000000000 --- a/src/test/run-fail/unwind-resource-fail2.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-test leaks -// error-pattern:wombat - -use std::gc::GC; - -struct r { - i: int, -} - -impl Drop for r { - fn drop(&mut self) { fail!("wombat") } -} - -fn r(i: int) -> r { r { i: i } } - -fn main() { - box(GC) 0; - let r = r(0); - fail!(); -} diff --git a/src/test/run-fail/unwind-resource-fail3.rs b/src/test/run-fail/unwind-resource-fail3.rs deleted file mode 100644 index 9ec7c4a1eb3..00000000000 --- a/src/test/run-fail/unwind-resource-fail3.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(unsafe_destructor)] - -// error-pattern:quux - -use std::gc::{Gc, GC}; - -struct faily_box { - i: Gc -} -// What happens to the box pointer owned by this class? - -fn faily_box(i: Gc) -> faily_box { faily_box { i: i } } - -#[unsafe_destructor] -impl Drop for faily_box { - fn drop(&mut self) { - fail!("quux"); - } -} - -fn main() { - faily_box(box(GC) 10); -} diff --git a/src/test/run-fail/unwind-stacked.rs b/src/test/run-fail/unwind-stacked.rs deleted file mode 100644 index 1e1caac0004..00000000000 --- a/src/test/run-fail/unwind-stacked.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:fail - - -use std::gc::GC; - -fn f() { - let _a = box(GC) 0i; - fail!(); -} - -fn g() { - let _b = box(GC) 0i; - f(); -} - -fn main() { - let _a = box(GC) 0i; - g(); -} diff --git a/src/test/run-fail/unwind-tup.rs b/src/test/run-fail/unwind-tup.rs deleted file mode 100644 index 877e2beb703..00000000000 --- a/src/test/run-fail/unwind-tup.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::Gc; - -// error-pattern:fail - -fn fold_local() -> Gc> { - fail!(); -} - -fn main() { - let _lss = (fold_local(), 0i); -} diff --git a/src/test/run-fail/unwind-tup2.rs b/src/test/run-fail/unwind-tup2.rs deleted file mode 100644 index 01536233ffe..00000000000 --- a/src/test/run-fail/unwind-tup2.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -// error-pattern:fail - -fn fold_local() -> Gc> { - box(GC) vec!(0,0,0,0,0,0) -} - -fn fold_remote() -> Gc> { - fail!(); -} - -fn main() { - let _lss = (fold_local(), fold_remote()); -} diff --git a/src/test/run-fail/unwind-uninitialized.rs b/src/test/run-fail/unwind-uninitialized.rs deleted file mode 100644 index 54321e98e73..00000000000 --- a/src/test/run-fail/unwind-uninitialized.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:fail - - -use std::gc::GC; - -fn f() { - fail!(); -} - -fn main() { - f(); - let _a = box(GC) 0i; -} diff --git a/src/test/run-pass/assert-eq-macro-success.rs b/src/test/run-pass/assert-eq-macro-success.rs index 7cc4fab999c..49a374f343c 100644 --- a/src/test/run-pass/assert-eq-macro-success.rs +++ b/src/test/run-pass/assert-eq-macro-success.rs @@ -9,8 +9,6 @@ // except according to those terms. -use std::gc::GC; - #[deriving(PartialEq, Show)] struct Point { x : int } @@ -19,5 +17,4 @@ pub fn main() { assert_eq!("abc".to_string(),"abc".to_string()); assert_eq!(box Point{x:34},box Point{x:34}); assert_eq!(&Point{x:34},&Point{x:34}); - assert_eq!(box(GC) Point{x:34},box(GC) Point{x:34}); } diff --git a/src/test/run-pass/autoderef-method-priority.rs b/src/test/run-pass/autoderef-method-priority.rs index 2bad924192f..cc4dd13cf61 100644 --- a/src/test/run-pass/autoderef-method-priority.rs +++ b/src/test/run-pass/autoderef-method-priority.rs @@ -9,8 +9,6 @@ // except according to those terms. -use std::gc::{GC, Gc}; - trait double { fn double(self) -> uint; } @@ -19,11 +17,11 @@ impl double for uint { fn double(self) -> uint { self } } -impl double for Gc { +impl double for Box { fn double(self) -> uint { *self * 2u } } pub fn main() { - let x = box(GC) 3u; + let x = box 3u; assert_eq!(x.double(), 6u); } diff --git a/src/test/run-pass/autoref-intermediate-types-issue-3585.rs b/src/test/run-pass/autoref-intermediate-types-issue-3585.rs index ac19c373bb2..7f44bcdb50c 100644 --- a/src/test/run-pass/autoref-intermediate-types-issue-3585.rs +++ b/src/test/run-pass/autoref-intermediate-types-issue-3585.rs @@ -9,15 +9,13 @@ // except according to those terms. -use std::gc::{Gc, GC}; - trait Foo { fn foo(&self) -> String; } -impl Foo for Gc { +impl Foo for Box { fn foo(&self) -> String { - format!("box(GC) {}", (**self).foo()) + format!("box {}", (**self).foo()) } } @@ -28,6 +26,6 @@ fn foo(&self) -> String { } pub fn main() { - let x = box(GC) 3u; - assert_eq!(x.foo(), "box(GC) 3".to_string()); + let x = box 3u; + assert_eq!(x.foo(), "box 3".to_string()); } diff --git a/src/test/run-pass/binops.rs b/src/test/run-pass/binops.rs index 2551dafe345..3997c5d3d29 100644 --- a/src/test/run-pass/binops.rs +++ b/src/test/run-pass/binops.rs @@ -10,9 +10,6 @@ // Binop corner cases - -use std::gc::GC; - fn test_nil() { assert_eq!((), ()); assert!((!(() != ()))); @@ -45,10 +42,6 @@ fn test_bool() { assert_eq!(true ^ true, false); } -fn test_box() { - assert_eq!(box(GC) 10i, box(GC) 10i); -} - fn test_ptr() { unsafe { let p1: *const u8 = ::std::mem::transmute(0u); @@ -98,7 +91,6 @@ fn test_class() { pub fn main() { test_nil(); test_bool(); - test_box(); test_ptr(); test_class(); } diff --git a/src/test/run-pass/borrowck-borrow-from-expr-block.rs b/src/test/run-pass/borrowck-borrow-from-expr-block.rs index 7222d655a40..8c4995e7100 100644 --- a/src/test/run-pass/borrowck-borrow-from-expr-block.rs +++ b/src/test/run-pass/borrowck-borrow-from-expr-block.rs @@ -9,13 +9,11 @@ // except according to those terms. -use std::gc::{Gc, GC}; - fn borrow(x: &int, f: |x: &int|) { f(x) } -fn test1(x: Gc>) { +fn test1(x: &Box) { borrow(&*(*x).clone(), |p| { let x_a = &**x as *const int; assert!((x_a as uint) != (p as *const int as uint)); @@ -24,5 +22,5 @@ fn test1(x: Gc>) { } pub fn main() { - test1(box(GC) box 22); + test1(&box 22); } diff --git a/src/test/run-pass/borrowck-preserve-box-in-moved-value.rs b/src/test/run-pass/borrowck-preserve-box-in-moved-value.rs deleted file mode 100644 index 525a93a4c83..00000000000 --- a/src/test/run-pass/borrowck-preserve-box-in-moved-value.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// exec-env:RUST_POISON_ON_FREE=1 - -// Test that we root `x` even though it is found in immutable memory, -// because it is moved. - - -use std::gc::{Gc, GC}; - -fn free(x: Gc) {} - -struct Foo { - f: Gc -} - -struct Bar { - g: int -} - -fn lend(x: Gc) -> int { - let y = &x.f.g; - free(x); // specifically here, if x is not rooted, it will be freed - *y -} - -pub fn main() { - assert_eq!(lend(box(GC) Foo {f: box(GC) Bar {g: 22}}), 22); -} diff --git a/src/test/run-pass/borrowck-root-while-cond-2.rs b/src/test/run-pass/borrowck-root-while-cond-2.rs deleted file mode 100644 index 344867568bb..00000000000 --- a/src/test/run-pass/borrowck-root-while-cond-2.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{GC, Gc}; - -struct F { f: Gc } -struct G { g: Vec } - -pub fn main() { - let rec = box(GC) F {f: box(GC) G {g: vec!(1, 2, 3)}}; - while rec.f.g.len() == 23 {} -} diff --git a/src/test/run-pass/borrowck-root-while-cond.rs b/src/test/run-pass/borrowck-root-while-cond.rs deleted file mode 100644 index 163ccf5c029..00000000000 --- a/src/test/run-pass/borrowck-root-while-cond.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -fn borrow<'r,T>(x: &'r T) -> &'r T {x} - -struct Rec { f: Gc } - -pub fn main() { - let rec = box(GC) Rec {f: box(GC) 22}; - while *borrow(&*rec.f) == 23 {} -} diff --git a/src/test/run-pass/borrowck-univariant-enum.rs b/src/test/run-pass/borrowck-univariant-enum.rs index 8192566da19..129fa8bf7d9 100644 --- a/src/test/run-pass/borrowck-univariant-enum.rs +++ b/src/test/run-pass/borrowck-univariant-enum.rs @@ -10,7 +10,6 @@ use std::cell::Cell; -use std::gc::GC; enum newtype { newvar(int) @@ -21,8 +20,8 @@ pub fn main() { // Test that borrowck treats enums with a single variant // specially. - let x = box(GC) Cell::new(5); - let y = box(GC) Cell::new(newvar(3)); + let x = &Cell::new(5); + let y = &Cell::new(newvar(3)); let z = match y.get() { newvar(b) => { x.set(x.get() + 1); diff --git a/src/test/run-pass/box-compare.rs b/src/test/run-pass/box-compare.rs deleted file mode 100644 index 9e8e416d7b0..00000000000 --- a/src/test/run-pass/box-compare.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::GC; - -pub fn main() { - assert!((box(GC) 1i < box(GC) 3i)); - assert!((box(GC) box(GC) "hello ".to_string() > - box(GC) box(GC) "hello".to_string())); - assert!((box(GC) box(GC) box(GC) "hello".to_string() != - box(GC) box(GC) box(GC) "there".to_string())); -} diff --git a/src/test/run-pass/box-in-tup.rs b/src/test/run-pass/box-in-tup.rs deleted file mode 100644 index 8d7bb55028f..00000000000 --- a/src/test/run-pass/box-in-tup.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -pub fn main() { - let i: (Gc, int) = (box(GC) 10, 10); - let (_a, _) = i; -} diff --git a/src/test/run-pass/box-inside-if.rs b/src/test/run-pass/box-inside-if.rs deleted file mode 100644 index 47c7e7f16f4..00000000000 --- a/src/test/run-pass/box-inside-if.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{GC, Gc}; - -fn some_box(x: int) -> Gc { return box(GC) x; } - -fn is_odd(_n: int) -> bool { return true; } - -fn length_is_even(_vs: Gc) -> bool { return true; } - -fn foo(_acc: int, n: int) { - if is_odd(n) && length_is_even(some_box(1)) { println!("bloop"); } -} - -pub fn main() { foo(67, 5); } diff --git a/src/test/run-pass/box-inside-if2.rs b/src/test/run-pass/box-inside-if2.rs deleted file mode 100644 index e62050c8ea9..00000000000 --- a/src/test/run-pass/box-inside-if2.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -fn some_box(x: int) -> Gc { return box(GC) x; } - -fn is_odd(_n: int) -> bool { return true; } - -fn length_is_even(_vs: Gc) -> bool { return true; } - -fn foo(_acc: int, n: int) { - if is_odd(n) || length_is_even(some_box(1)) { println!("bloop"); } -} - -pub fn main() { foo(67, 5); } diff --git a/src/test/run-pass/box-pattern.rs b/src/test/run-pass/box-pattern.rs deleted file mode 100644 index 21d1d235901..00000000000 --- a/src/test/run-pass/box-pattern.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn main() { - let box x = box 3i; - match box 3i { - box y => { - assert!(x == y); - println!("{} {}", x, y); - } - } -} - diff --git a/src/test/run-pass/box-unbox.rs b/src/test/run-pass/box-unbox.rs deleted file mode 100644 index bc8afff0cd6..00000000000 --- a/src/test/run-pass/box-unbox.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -struct Box {c: Gc} - -fn unbox(b: Box) -> T { return (*b.c).clone(); } - -pub fn main() { - let foo: int = 17; - let bfoo: Box = Box {c: box(GC) foo}; - println!("see what's in our box"); - assert_eq!(unbox::(bfoo), foo); -} diff --git a/src/test/run-pass/box.rs b/src/test/run-pass/box.rs deleted file mode 100644 index 844b9392ec8..00000000000 --- a/src/test/run-pass/box.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -pub fn main() { let x: Gc = box(GC) 10; assert!((*x == 10)); } diff --git a/src/test/run-pass/boxed-class-type-substitution.rs b/src/test/run-pass/boxed-class-type-substitution.rs deleted file mode 100644 index 41ffdd7b4b9..00000000000 --- a/src/test/run-pass/boxed-class-type-substitution.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Regression test that rustc doesn't recurse infinitely substituting -// the boxed type parameter - - -use std::gc::Gc; - -struct Tree { - parent: Option -} - -fn empty() -> Tree { fail!() } - -struct Box { - tree: Tree> -} - -fn Box() -> Box { - Box { - tree: empty() - } -} - -struct LayoutData { - a_box: Option> -} - -pub fn main() { } diff --git a/src/test/run-pass/cci_borrow.rs b/src/test/run-pass/cci_borrow.rs index e319866d5ce..262c19174b1 100644 --- a/src/test/run-pass/cci_borrow.rs +++ b/src/test/run-pass/cci_borrow.rs @@ -13,10 +13,9 @@ extern crate cci_borrow_lib; use cci_borrow_lib::foo; -use std::gc::GC; pub fn main() { - let p = box(GC) 22u; + let p = box 22u; let r = foo(&*p); println!("r={}", r); assert_eq!(r, 22u); diff --git a/src/test/run-pass/classes-self-referential.rs b/src/test/run-pass/classes-self-referential.rs index 099431acd24..a54a821a7b9 100644 --- a/src/test/run-pass/classes-self-referential.rs +++ b/src/test/run-pass/classes-self-referential.rs @@ -9,8 +9,6 @@ // except according to those terms. -use std::gc::Gc; - struct kitten { cat: Option, } @@ -21,6 +19,6 @@ fn kitten(cat: Option) -> kitten { } } -type cat = Gc; +type cat = Box; pub fn main() {} diff --git a/src/test/run-pass/cleanup-copy-mode.rs b/src/test/run-pass/cleanup-copy-mode.rs deleted file mode 100644 index 3eec506c9e3..00000000000 --- a/src/test/run-pass/cleanup-copy-mode.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::task; -use std::gc::{GC, Gc}; - -fn adder(x: Gc, y: Gc) -> int { return *x + *y; } -fn failer() -> Gc { fail!(); } -pub fn main() { - assert!(task::try(proc() { - adder(box(GC) 2, failer()); () - }).is_err()); -} diff --git a/src/test/run-pass/crate-method-reexport-grrrrrrr.rs b/src/test/run-pass/crate-method-reexport-grrrrrrr.rs index 481a922a463..0088a36eda9 100644 --- a/src/test/run-pass/crate-method-reexport-grrrrrrr.rs +++ b/src/test/run-pass/crate-method-reexport-grrrrrrr.rs @@ -17,12 +17,10 @@ extern crate crate_method_reexport_grrrrrrr2; -use std::gc::GC; - pub fn main() { use crate_method_reexport_grrrrrrr2::rust::add; use crate_method_reexport_grrrrrrr2::rust::cx; - let x = box(GC) (); + let x = box() (); x.cx(); let y = (); y.add("hi".to_string()); diff --git a/src/test/run-pass/cycle-collection.rs b/src/test/run-pass/cycle-collection.rs deleted file mode 100644 index edcbd21476b..00000000000 --- a/src/test/run-pass/cycle-collection.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::cell::RefCell; -use std::gc::{Gc, GC}; - -enum taggy { - cons(Gc>), - nil, -} - -fn f() { - let a_box = box(GC) RefCell::new(nil); - *a_box.borrow_mut() = cons(a_box); -} - -pub fn main() { - f(); -} diff --git a/src/test/run-pass/deref-lval.rs b/src/test/run-pass/deref-lval.rs index 4ccf6744d5c..d9b0940f80b 100644 --- a/src/test/run-pass/deref-lval.rs +++ b/src/test/run-pass/deref-lval.rs @@ -9,13 +9,10 @@ // except according to those terms. -extern crate debug; - use std::cell::Cell; -use std::gc::GC; pub fn main() { - let x = box(GC) Cell::new(5i); + let x = box Cell::new(5i); x.set(1000i); - println!("{:?}", x.get()); + println!("{}", x.get()); } diff --git a/src/test/run-pass/deref.rs b/src/test/run-pass/deref.rs index 12fc65cecb9..117b133a113 100644 --- a/src/test/run-pass/deref.rs +++ b/src/test/run-pass/deref.rs @@ -9,9 +9,7 @@ // except according to those terms. -use std::gc::{Gc, GC}; - pub fn main() { - let x: Gc = box(GC) 10; + let x: Box = box 10; let _y: int = *x; } diff --git a/src/test/run-pass/double-unbox.rs b/src/test/run-pass/double-unbox.rs deleted file mode 100644 index 0d5556a867b..00000000000 --- a/src/test/run-pass/double-unbox.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::Gc; - -struct Quux { - bar: int -} - -fn g(_i: int) { } -fn f(foo: Gc>) { g(foo.bar); } - -pub fn main() { } diff --git a/src/test/run-pass/drop-on-empty-block-exit.rs b/src/test/run-pass/drop-on-empty-block-exit.rs index 8add96d8ed7..c52549d286f 100644 --- a/src/test/run-pass/drop-on-empty-block-exit.rs +++ b/src/test/run-pass/drop-on-empty-block-exit.rs @@ -9,11 +9,9 @@ // except according to those terms. -use std::gc::{Gc, GC}; - -enum t { foo(Gc), } +enum t { foo(Box), } pub fn main() { - let tt = foo(box(GC) 10); + let tt = foo(box 10); match tt { foo(_z) => { } } } diff --git a/src/test/run-pass/enum-null-pointer-opt.rs b/src/test/run-pass/enum-null-pointer-opt.rs index 433c3b54224..3e22c833183 100644 --- a/src/test/run-pass/enum-null-pointer-opt.rs +++ b/src/test/run-pass/enum-null-pointer-opt.rs @@ -9,7 +9,6 @@ // except according to those terms. -use std::gc::Gc; use std::mem::size_of; trait Trait {} @@ -33,9 +32,8 @@ fn main() { assert_eq!(size_of::<&Trait>(), size_of::>()); assert_eq!(size_of::<&mut Trait>(), size_of::>()); - // Pointers - Box / Gc + // Pointers - Box assert_eq!(size_of::>(), size_of::>>()); - assert_eq!(size_of::>(), size_of::>>()); // The optimization can't apply to raw pointers diff --git a/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs b/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs index 7d8a3d3fb79..24fb503aea3 100644 --- a/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs +++ b/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs @@ -15,11 +15,9 @@ * represented with nullable pointers could be misoptimized in some cases. */ -use std::gc::{Gc, GC}; - -enum List { Nil, Cons(X, Gc>) } +enum List { Nil, Cons(X, Box>) } pub fn main() { - match Cons(10i, box(GC) Nil) { + match Cons(10i, box Nil) { Cons(10i, _) => {} Nil => {} _ => fail!() diff --git a/src/test/run-pass/evec-internal-boxes.rs b/src/test/run-pass/evec-internal-boxes.rs deleted file mode 100644 index 63e034c0eaa..00000000000 --- a/src/test/run-pass/evec-internal-boxes.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(dead_assignment)] - -use std::gc::{Gc, GC}; - -pub fn main() { - let x : [Gc, ..5] = [box(GC) 1,box(GC) 2,box(GC) 3,box(GC) 4,box(GC) 5]; - let _y : [Gc, ..5] = [box(GC) 1,box(GC) 2,box(GC) 3,box(GC) 4,box(GC) 5]; - let mut z = [box(GC) 1,box(GC) 2,box(GC) 3,box(GC) 4,box(GC) 5]; - z = x; - assert_eq!(*z[0], 1); - assert_eq!(*z[4], 5); -} diff --git a/src/test/run-pass/export-non-interference.rs b/src/test/run-pass/export-non-interference.rs index 424a09227ec..94652e30fe6 100644 --- a/src/test/run-pass/export-non-interference.rs +++ b/src/test/run-pass/export-non-interference.rs @@ -9,8 +9,6 @@ // except according to those terms. -use std::gc::Gc; - -enum list_cell { cons(Gc>), nil } +enum list_cell { cons(Box>), nil } pub fn main() { } diff --git a/src/test/run-pass/expr-block-box.rs b/src/test/run-pass/expr-block-box.rs deleted file mode 100644 index 9b3d2028edf..00000000000 --- a/src/test/run-pass/expr-block-box.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::GC; - -pub fn main() { let x = { box(GC) 100i }; assert!((*x == 100)); } diff --git a/src/test/run-pass/expr-block-generic-box1.rs b/src/test/run-pass/expr-block-generic-box1.rs deleted file mode 100644 index dfcef171252..00000000000 --- a/src/test/run-pass/expr-block-generic-box1.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -type compare = |Gc, Gc|: 'static -> bool; - -fn test_generic(expected: Gc, eq: compare) { - let actual: Gc = { expected }; - assert!((eq(expected, actual))); -} - -fn test_box() { - fn compare_box(b1: Gc, b2: Gc) -> bool { - println!("{}", *b1); - println!("{}", *b2); - return *b1 == *b2; - } - test_generic::(box(GC) true, compare_box); -} - -pub fn main() { test_box(); } diff --git a/src/test/run-pass/expr-block-generic-box2.rs b/src/test/run-pass/expr-block-generic-box2.rs deleted file mode 100644 index 547e7dfa911..00000000000 --- a/src/test/run-pass/expr-block-generic-box2.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{GC, Gc}; - -type compare<'a, T> = |T, T|: 'a -> bool; - -fn test_generic(expected: T, eq: compare) { - let actual: T = { expected.clone() }; - assert!((eq(expected, actual))); -} - -fn test_vec() { - fn compare_vec(v1: Gc, v2: Gc) -> bool { return v1 == v2; } - test_generic::>(box(GC) 1, compare_vec); -} - -pub fn main() { test_vec(); } diff --git a/src/test/run-pass/expr-block-ref.rs b/src/test/run-pass/expr-block-ref.rs deleted file mode 100644 index 3d649b17b79..00000000000 --- a/src/test/run-pass/expr-block-ref.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::GC; - -// Regression test for issue #388 -pub fn main() { let _x = { { box(GC) 10i } }; } diff --git a/src/test/run-pass/expr-elseif-ref.rs b/src/test/run-pass/expr-elseif-ref.rs deleted file mode 100644 index f0b9c85a53d..00000000000 --- a/src/test/run-pass/expr-elseif-ref.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -// Make sure we drop the refs of the temporaries needed to return the -// values from the else if branch -pub fn main() { - let y: Gc = box(GC) 10u; - let _x = if false { y } else if true { y } else { y }; - assert_eq!(*y, 10u); -} diff --git a/src/test/run-pass/expr-elseif-ref2.rs b/src/test/run-pass/expr-elseif-ref2.rs deleted file mode 100644 index 9d4efea7e3d..00000000000 --- a/src/test/run-pass/expr-elseif-ref2.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{GC}; - -// Regression test for issue #388 -pub fn main() { - let _x = if false { - box(GC) 0u - } else if true { - box(GC) 10u - } else { - box(GC) 0u - }; -} diff --git a/src/test/run-pass/expr-if-box.rs b/src/test/run-pass/expr-if-box.rs deleted file mode 100644 index 3def4571e13..00000000000 --- a/src/test/run-pass/expr-if-box.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -// Tests for if as expressions returning boxed types -fn test_box() { - let rs = if true { box(GC) 100i } else { box(GC) 101i }; - assert_eq!(*rs, 100); -} - -fn test_str() { - let rs = if true { "happy".to_string() } else { "sad".to_string() }; - assert_eq!(rs, "happy".to_string()); -} - -pub fn main() { test_box(); test_str(); } diff --git a/src/test/run-pass/expr-if-generic-box1.rs b/src/test/run-pass/expr-if-generic-box1.rs deleted file mode 100644 index 931f500a309..00000000000 --- a/src/test/run-pass/expr-if-generic-box1.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{GC, Gc}; - -type compare = |Gc, Gc|: 'static -> bool; - -fn test_generic(expected: Gc, not_expected: Gc, eq: compare) { - let actual: Gc = if true { expected } else { not_expected }; - assert!((eq(expected, actual))); -} - -fn test_box() { - fn compare_box(b1: Gc, b2: Gc) -> bool { return *b1 == *b2; } - test_generic::(box(GC) true, box(GC) false, compare_box); -} - -pub fn main() { test_box(); } diff --git a/src/test/run-pass/expr-if-generic-box2.rs b/src/test/run-pass/expr-if-generic-box2.rs deleted file mode 100644 index b8b8c9b89a8..00000000000 --- a/src/test/run-pass/expr-if-generic-box2.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -type compare = |T, T|: 'static -> bool; - -fn test_generic(expected: T, not_expected: T, eq: compare) { - let actual: T = if true { expected.clone() } else { not_expected }; - assert!((eq(expected, actual))); -} - -fn test_vec() { - fn compare_box(v1: Gc, v2: Gc) -> bool { return v1 == v2; } - test_generic::>(box(GC) 1, box(GC) 2, compare_box); -} - -pub fn main() { test_vec(); } diff --git a/src/test/run-pass/expr-match-box.rs b/src/test/run-pass/expr-match-box.rs deleted file mode 100644 index c2ba36006bd..00000000000 --- a/src/test/run-pass/expr-match-box.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::GC; - -// Tests for match as expressions resulting in boxed types -fn test_box() { - let res = match true { true => { box(GC) 100i } _ => fail!("wat") }; - assert_eq!(*res, 100i); -} - -fn test_str() { - let res = match true { true => { "happy".to_string() }, - _ => fail!("not happy at all") }; - assert_eq!(res, "happy".to_string()); -} - -pub fn main() { test_box(); test_str(); } diff --git a/src/test/run-pass/expr-match-generic-box1.rs b/src/test/run-pass/expr-match-generic-box1.rs deleted file mode 100644 index 97fa53b5e24..00000000000 --- a/src/test/run-pass/expr-match-generic-box1.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -type compare = |Gc, Gc|: 'static -> bool; - -fn test_generic(expected: Gc, eq: compare) { - let actual: Gc = match true { true => { expected }, _ => fail!() }; - assert!((eq(expected, actual))); -} - -fn test_box() { - fn compare_box(b1: Gc, b2: Gc) -> bool { return *b1 == *b2; } - test_generic::(box(GC) true, compare_box); -} - -pub fn main() { test_box(); } diff --git a/src/test/run-pass/expr-match-generic-box2.rs b/src/test/run-pass/expr-match-generic-box2.rs deleted file mode 100644 index fd8179c59a5..00000000000 --- a/src/test/run-pass/expr-match-generic-box2.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -type compare = |T, T|: 'static -> bool; - -fn test_generic(expected: T, eq: compare) { - let actual: T = match true { true => { expected.clone() }, _ => fail!("wat") }; - assert!((eq(expected, actual))); -} - -fn test_vec() { - fn compare_box(v1: Gc, v2: Gc) -> bool { return v1 == v2; } - test_generic::>(box(GC) 1, compare_box); -} - -pub fn main() { test_vec(); } diff --git a/src/test/run-pass/exterior.rs b/src/test/run-pass/exterior.rs index cd0f3d6101a..e95c2034131 100644 --- a/src/test/run-pass/exterior.rs +++ b/src/test/run-pass/exterior.rs @@ -10,11 +10,10 @@ use std::cell::Cell; -use std::gc::{Gc, GC}; struct Point {x: int, y: int, z: int} -fn f(p: Gc>) { +fn f(p: &Cell) { assert!((p.get().z == 12)); p.set(Point {x: 10, y: 11, z: 13}); assert!((p.get().z == 13)); @@ -22,7 +21,7 @@ fn f(p: Gc>) { pub fn main() { let a: Point = Point {x: 10, y: 11, z: 12}; - let b: Gc> = box(GC) Cell::new(a); + let b: &Cell = &Cell::new(a); assert_eq!(b.get().z, 12); f(b); assert_eq!(a.z, 12); diff --git a/src/test/run-pass/fail-during-tld-destroy.rs b/src/test/run-pass/fail-during-tld-destroy.rs index 835f1fe4d4a..3faa30c4c8a 100644 --- a/src/test/run-pass/fail-during-tld-destroy.rs +++ b/src/test/run-pass/fail-during-tld-destroy.rs @@ -9,45 +9,25 @@ // except according to those terms. use std::task; -use std::gc::{GC, Gc}; -use std::cell::RefCell; static mut DROPS: uint = 0; -struct Foo(bool); +struct Foo; impl Drop for Foo { fn drop(&mut self) { - let Foo(fail) = *self; unsafe { DROPS += 1; } - if fail { fail!() } + fail!() } } -fn tld_fail(fail: bool) { - local_data_key!(foo: Foo); - foo.replace(Some(Foo(fail))); -} - -fn gc_fail(fail: bool) { - struct A { - inner: RefCell>>, - other: Foo, - } - let a = box(GC) A { - inner: RefCell::new(None), - other: Foo(fail), - }; - *a.inner.borrow_mut() = Some(a.clone()); -} - fn main() { let _ = task::try(proc() { - tld_fail(true); - gc_fail(false); + local_data_key!(foo: Foo); + foo.replace(Some(Foo)); }); unsafe { - assert_eq!(DROPS, 2); + assert_eq!(DROPS, 1); } } diff --git a/src/test/run-pass/gc-vec.rs b/src/test/run-pass/gc-vec.rs deleted file mode 100644 index 430ee16bc8a..00000000000 --- a/src/test/run-pass/gc-vec.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::gc::{GC}; - -fn main() { - // A fixed-size array allocated in a garbage-collected box - let x = box(GC) [1i, 2, 3, 4, 5, 6, 7, 8, 9, 10]; - assert_eq!(x[0], 1); - assert_eq!(x[6], 7); - assert_eq!(x[9], 10); - - let y = x; - assert!(*y == [1i, 2, 3, 4, 5, 6, 7, 8, 9, 10]); -} diff --git a/src/test/run-pass/generic-alias-box.rs b/src/test/run-pass/generic-alias-box.rs deleted file mode 100644 index 325f6a2c854..00000000000 --- a/src/test/run-pass/generic-alias-box.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -extern crate debug; - -use std::gc::{Gc, GC}; - -fn id(t: T) -> T { return t; } - -pub fn main() { - let expected = box(GC) 100; - let actual = id::>(expected); - println!("{:?}", *actual); - assert_eq!(*expected, *actual); -} diff --git a/src/test/run-pass/generic-box.rs b/src/test/run-pass/generic-box.rs deleted file mode 100644 index d5047eb8f86..00000000000 --- a/src/test/run-pass/generic-box.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -fn box_it(x: Box) -> Gc> { return box(GC) x; } - -struct Box {x: T, y: T, z: T} - -pub fn main() { - let x: Gc> = box_it::(Box{x: 1, y: 2, z: 3}); - assert_eq!(x.y, 2); -} diff --git a/src/test/run-pass/generic-drop-glue.rs b/src/test/run-pass/generic-drop-glue.rs deleted file mode 100644 index 2cc3a89459e..00000000000 --- a/src/test/run-pass/generic-drop-glue.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -struct Pair { x: Gc, y: Gc } - -fn f(t: T) { let _t1: T = t; } - -pub fn main() { let x = Pair {x: box(GC) 10, y: box(GC) 12}; f(x); } diff --git a/src/test/run-pass/generic-exterior-box.rs b/src/test/run-pass/generic-exterior-box.rs deleted file mode 100644 index 2c1ae5d9854..00000000000 --- a/src/test/run-pass/generic-exterior-box.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -struct Recbox {x: Gc} - -fn reclift(t: T) -> Recbox { return Recbox {x: box(GC) t}; } - -pub fn main() { - let foo: int = 17; - let rbfoo: Recbox = reclift::(foo); - assert_eq!(*rbfoo.x, foo); -} diff --git a/src/test/run-pass/generic-fn-box.rs b/src/test/run-pass/generic-fn-box.rs deleted file mode 100644 index 2164b00e066..00000000000 --- a/src/test/run-pass/generic-fn-box.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -extern crate debug; - -use std::gc::{Gc, GC}; - -fn f(x: Gc) -> Gc { return x; } - -pub fn main() { let x = f(box(GC) 3i); println!("{:?}", *x); } diff --git a/src/test/run-pass/generic-ivec.rs b/src/test/run-pass/generic-ivec.rs deleted file mode 100644 index 68e7b98183b..00000000000 --- a/src/test/run-pass/generic-ivec.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -fn f(_v: Gc) { } -pub fn main() { f(box(GC) vec!(1i, 2, 3, 4, 5)); } diff --git a/src/test/run-pass/generic-recursive-tag.rs b/src/test/run-pass/generic-recursive-tag.rs index 6d81cea8b2f..d8777515cec 100644 --- a/src/test/run-pass/generic-recursive-tag.rs +++ b/src/test/run-pass/generic-recursive-tag.rs @@ -11,14 +11,12 @@ // ignore-pretty FIXME(#14193) -use std::gc::{Gc, GC}; - -enum list { cons(Gc, Gc>), nil, } +enum list { cons(Box, Box>), nil, } pub fn main() { let _a: list = - cons::(box(GC) 10, - box(GC) cons::(box(GC) 12, - box(GC) cons::(box(GC) 13, - box(GC) nil::))); + cons::(box 10, + box cons::(box 12, + box cons::(box 13, + box nil::))); } diff --git a/src/test/run-pass/generic-tag.rs b/src/test/run-pass/generic-tag.rs index 43cdf43ceb3..52e512e515c 100644 --- a/src/test/run-pass/generic-tag.rs +++ b/src/test/run-pass/generic-tag.rs @@ -11,11 +11,9 @@ #![allow(dead_assignment)] #![allow(unused_variable)] -use std::gc::{Gc, GC}; - -enum option { some(Gc), none, } +enum option { some(Box), none, } pub fn main() { - let mut a: option = some::(box(GC) 10); + let mut a: option = some::(box 10); a = none::; } diff --git a/src/test/run-pass/ifmt.rs b/src/test/run-pass/ifmt.rs index 78e17bb22bd..365070f704f 100644 --- a/src/test/run-pass/ifmt.rs +++ b/src/test/run-pass/ifmt.rs @@ -18,7 +18,6 @@ extern crate debug; use std::fmt; -use std::gc::GC; use std::io::MemWriter; use std::io; use std::str; @@ -50,7 +49,6 @@ pub fn main() { t!(format!("{:?}", 1i), "1"); t!(format!("{:?}", A), "A"); t!(format!("{:?}", ()), "()"); - t!(format!("{:?}", box(GC) (box 1i, "foo")), "box(GC) (box 1, \"foo\")"); // Various edge cases without formats t!(format!(""), ""); diff --git a/src/test/run-pass/init-res-into-things.rs b/src/test/run-pass/init-res-into-things.rs index d6920b2e2fe..752e95f25dc 100644 --- a/src/test/run-pass/init-res-into-things.rs +++ b/src/test/run-pass/init-res-into-things.rs @@ -11,52 +11,43 @@ #![feature(unsafe_destructor)] use std::cell::Cell; -use std::gc::{Gc, GC}; // Resources can't be copied, but storing into data structures counts // as a move unless the stored thing is used afterwards. -struct r { - i: Gc>, +struct r<'a> { + i: &'a Cell, } -struct Box { x: r } +struct BoxR<'a> { x: r<'a> } #[unsafe_destructor] -impl Drop for r { +impl<'a> Drop for r<'a> { fn drop(&mut self) { self.i.set(self.i.get() + 1) } } -fn r(i: Gc>) -> r { +fn r(i: &Cell) -> r { r { i: i } } -fn test_box() { - let i = box(GC) Cell::new(0i); - { - let _a = box(GC) r(i); - } - assert_eq!(i.get(), 1); -} - fn test_rec() { - let i = box(GC) Cell::new(0i); + let i = &Cell::new(0i); { - let _a = Box {x: r(i)}; + let _a = BoxR {x: r(i)}; } assert_eq!(i.get(), 1); } fn test_tag() { - enum t { - t0(r), + enum t<'a> { + t0(r<'a>), } - let i = box(GC) Cell::new(0i); + let i = &Cell::new(0i); { let _a = t0(r(i)); } @@ -64,7 +55,7 @@ enum t { } fn test_tup() { - let i = box(GC) Cell::new(0i); + let i = &Cell::new(0i); { let _a = (r(i), 0i); } @@ -72,17 +63,17 @@ fn test_tup() { } fn test_unique() { - let i = box(GC) Cell::new(0i); + let i = &Cell::new(0i); { let _a = box r(i); } assert_eq!(i.get(), 1); } -fn test_box_rec() { - let i = box(GC) Cell::new(0i); +fn test_unique_rec() { + let i = &Cell::new(0i); { - let _a = box(GC) Box { + let _a = box BoxR { x: r(i) }; } @@ -90,10 +81,9 @@ fn test_box_rec() { } pub fn main() { - test_box(); test_rec(); test_tag(); test_tup(); test_unique(); - test_box_rec(); + test_unique_rec(); } diff --git a/src/test/run-pass/issue-14082.rs b/src/test/run-pass/issue-14082.rs index 9aff6b91748..dd9a7c97c9a 100644 --- a/src/test/run-pass/issue-14082.rs +++ b/src/test/run-pass/issue-14082.rs @@ -8,21 +8,20 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(globs)] #![allow(unused_imports, dead_code)] -use foo::GC; +use foo::Foo; mod foo { - pub use m::GC; // this should shadow d::GC + pub use m::Foo; // this should shadow d::Foo } mod m { - pub struct GC; + pub struct Foo; } mod d { - pub struct GC; + pub struct Foo; } fn main() {} diff --git a/src/test/run-pass/issue-2631-b.rs b/src/test/run-pass/issue-2631-b.rs index 777210d2b04..84f046499e4 100644 --- a/src/test/run-pass/issue-2631-b.rs +++ b/src/test/run-pass/issue-2631-b.rs @@ -11,17 +11,16 @@ // aux-build:issue-2631-a.rs -extern crate collections; extern crate req; use req::request; use std::cell::RefCell; use std::collections::HashMap; -use std::gc::GC; +use std::rc::Rc; pub fn main() { - let v = vec!(box(GC) "hi".to_string()); + let v = vec!(Rc::new("hi".to_string())); let mut m: req::header_map = HashMap::new(); - m.insert("METHOD".to_string(), box(GC) RefCell::new(v)); + m.insert("METHOD".to_string(), Rc::new(RefCell::new(v))); request::(&m); } diff --git a/src/test/run-pass/issue-2708.rs b/src/test/run-pass/issue-2708.rs index e11cb28c65d..3ac4b874f3a 100644 --- a/src/test/run-pass/issue-2708.rs +++ b/src/test/run-pass/issue-2708.rs @@ -9,8 +9,6 @@ // except according to those terms. -use std::gc::GC; - struct Font { fontbuf: uint, cairo_font: uint, @@ -31,5 +29,5 @@ fn Font() -> Font { } pub fn main() { - let _f = box(GC) Font(); + let _f = box Font(); } diff --git a/src/test/run-pass/issue-2735-2.rs b/src/test/run-pass/issue-2735-2.rs index f7a91d11748..0d1cf1c3392 100644 --- a/src/test/run-pass/issue-2735-2.rs +++ b/src/test/run-pass/issue-2735-2.rs @@ -11,28 +11,27 @@ #![feature(unsafe_destructor)] use std::cell::Cell; -use std::gc::{Gc, GC}; // This test should behave exactly like issue-2735-3 -struct defer { - b: Gc>, +struct defer<'a> { + b: &'a Cell, } #[unsafe_destructor] -impl Drop for defer { +impl<'a> Drop for defer<'a> { fn drop(&mut self) { self.b.set(true); } } -fn defer(b: Gc>) -> defer { +fn defer(b: &Cell) -> defer { defer { b: b } } pub fn main() { - let dtor_ran = box(GC) Cell::new(false); + let dtor_ran = &Cell::new(false); let _ = defer(dtor_ran); assert!(dtor_ran.get()); } diff --git a/src/test/run-pass/issue-2735-3.rs b/src/test/run-pass/issue-2735-3.rs index 3650c3f9246..658183cf6ff 100644 --- a/src/test/run-pass/issue-2735-3.rs +++ b/src/test/run-pass/issue-2735-3.rs @@ -11,28 +11,27 @@ #![feature(unsafe_destructor)] use std::cell::Cell; -use std::gc::{Gc, GC}; // This test should behave exactly like issue-2735-2 -struct defer { - b: Gc>, +struct defer<'a> { + b: &'a Cell, } #[unsafe_destructor] -impl Drop for defer { +impl<'a> Drop for defer<'a> { fn drop(&mut self) { self.b.set(true); } } -fn defer(b: Gc>) -> defer { +fn defer(b: &Cell) -> defer { defer { b: b } } pub fn main() { - let dtor_ran = box(GC) Cell::new(false); + let dtor_ran = &Cell::new(false); defer(dtor_ran); assert!(dtor_ran.get()); } diff --git a/src/test/run-pass/issue-3012-2.rs b/src/test/run-pass/issue-3012-2.rs index 96e60dab3c9..aa2ce824822 100644 --- a/src/test/run-pass/issue-3012-2.rs +++ b/src/test/run-pass/issue-3012-2.rs @@ -14,10 +14,9 @@ extern crate socketlib; extern crate libc; -use std::gc::GC; use socketlib::socket; pub fn main() { let fd: libc::c_int = 1 as libc::c_int; - let _sock = box(GC) socket::socket_handle(fd); + let _sock = box socket::socket_handle(fd); } diff --git a/src/test/run-pass/issue-3121.rs b/src/test/run-pass/issue-3121.rs index 24ffd416499..6b320e14746 100644 --- a/src/test/run-pass/issue-3121.rs +++ b/src/test/run-pass/issue-3121.rs @@ -9,13 +9,11 @@ // except according to those terms. -use std::gc::{Gc, GC}; - enum side { mayo, catsup, vinegar } enum order { hamburger, fries(side), shake } enum meal { to_go(order), for_here(order) } -fn foo(m: Gc, cond: bool) { +fn foo(m: Box, cond: bool) { match *m { to_go(_) => { } for_here(_) if cond => {} @@ -26,5 +24,5 @@ fn foo(m: Gc, cond: bool) { } pub fn main() { - foo(box(GC) for_here(hamburger), true) + foo(box for_here(hamburger), true) } diff --git a/src/test/run-pass/issue-3447.rs b/src/test/run-pass/issue-3447.rs index 612e0a07dac..4ebf981e4ee 100644 --- a/src/test/run-pass/issue-3447.rs +++ b/src/test/run-pass/issue-3447.rs @@ -10,13 +10,12 @@ use std::cell::RefCell; -use std::gc::{Gc, GC}; static S: &'static str = "str"; struct list { element: T, - next: Option>>> + next: Option>>> } impl list { @@ -26,7 +25,7 @@ pub fn addEnd(&mut self, element: T) { next: None }; - self.next = Some(box(GC) RefCell::new(newList)); + self.next = Some(box RefCell::new(newList)); } } diff --git a/src/test/run-pass/issue-3556.rs b/src/test/run-pass/issue-3556.rs index b8a34b75181..e59cf9f77fa 100644 --- a/src/test/run-pass/issue-3556.rs +++ b/src/test/run-pass/issue-3556.rs @@ -9,18 +9,15 @@ // except according to those terms. -extern crate debug; - -use std::gc::{Gc, GC}; - +#[deriving(Show)] enum Token { - Text(Gc), - ETag(Gc> , Gc), - UTag(Gc> , Gc), - Section(Gc> , bool, Gc>, Gc, - Gc, Gc, Gc, Gc), - IncompleteSection(Gc> , bool, Gc, bool), - Partial(Gc, Gc, Gc), + Text(String), + ETag(Vec, String), + UTag(Vec, String), + Section(Vec, bool, Vec, String, + String, String, String, String), + IncompleteSection(Vec, bool, String, bool), + Partial(String, String, String), } fn check_strs(actual: &str, expected: &str) -> bool @@ -39,13 +36,13 @@ pub fn main() // assert!(check_strs(fmt!("%?", ETag(@~["foo".to_string()], @"bar".to_string())), // "ETag(@~[ ~\"foo\" ], @~\"bar\")")); - let t = Text(box(GC) "foo".to_string()); - let u = Section(box(GC) vec!("alpha".to_string()), - true, - box(GC) vec!(t), - box(GC) "foo".to_string(), - box(GC) "foo".to_string(), box(GC) "foo".to_string(), box(GC) "foo".to_string(), - box(GC) "foo".to_string()); - let v = format!("{:?}", u); // this is the line that causes the seg fault + let t = Text("foo".to_string()); + let u = Section(vec!["alpha".to_string()], + true, + vec![t], + "foo".to_string(), + "foo".to_string(), "foo".to_string(), "foo".to_string(), + "foo".to_string()); + let v = format!("{}", u); // this is the line that causes the seg fault assert!(v.len() > 0); } diff --git a/src/test/run-pass/issue-5884.rs b/src/test/run-pass/issue-5884.rs index 93f8ebf02ac..4010c31eed5 100644 --- a/src/test/run-pass/issue-5884.rs +++ b/src/test/run-pass/issue-5884.rs @@ -9,8 +9,6 @@ // except according to those terms. -use std::gc::Gc; - pub struct Foo { a: int, } @@ -20,7 +18,7 @@ struct Bar<'a> { b: &'a Foo, } -fn check(a: Gc) { +fn check(a: Box) { let _ic = Bar{ b: &*a, a: box None }; } diff --git a/src/test/run-pass/issue-6117.rs b/src/test/run-pass/issue-6117.rs index e124b2efe29..7eaaa5ea74e 100644 --- a/src/test/run-pass/issue-6117.rs +++ b/src/test/run-pass/issue-6117.rs @@ -9,12 +9,10 @@ // except according to those terms. -use std::gc::GC; - enum Either { Left(T), Right(U) } pub fn main() { - match Left(box(GC) 17i) { + match Left(box 17i) { Right(()) => {} _ => {} } diff --git a/src/test/run-pass/issue-8898.rs b/src/test/run-pass/issue-8898.rs index f2dcaa4a31e..3fff58410a4 100644 --- a/src/test/run-pass/issue-8898.rs +++ b/src/test/run-pass/issue-8898.rs @@ -12,8 +12,6 @@ extern crate debug; -use std::gc::GC; - fn assert_repr_eq(obj : T, expected : String) { assert_eq!(expected, format!("{:?}", obj)); } @@ -23,12 +21,10 @@ pub fn main() { let tf = [true, false]; let x = [(), ()]; let slice = x[0..1]; - let z = box(GC) x; assert_repr_eq(abc, "[1, 2, 3]".to_string()); assert_repr_eq(tf, "[true, false]".to_string()); assert_repr_eq(x, "[(), ()]".to_string()); assert_repr_eq(slice, "&[()]".to_string()); assert_repr_eq(&x, "&[(), ()]".to_string()); - assert_repr_eq(z, "box(GC) [(), ()]".to_string()); } diff --git a/src/test/run-pass/issue-8983.rs b/src/test/run-pass/issue-8983.rs deleted file mode 100644 index 1291f0b6cd1..00000000000 --- a/src/test/run-pass/issue-8983.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::GC; - -fn main() { - fn f(_: proc()) {} - fn eat(_: T) {} - - let x = box(GC) 1i; - f(proc() { eat(x) }); -} diff --git a/src/test/run-pass/issue-979.rs b/src/test/run-pass/issue-979.rs index abe6a2d9ee6..919f0aae38e 100644 --- a/src/test/run-pass/issue-979.rs +++ b/src/test/run-pass/issue-979.rs @@ -11,27 +11,26 @@ #![feature(unsafe_destructor)] use std::cell::Cell; -use std::gc::{GC, Gc}; -struct r { - b: Gc>, +struct r<'a> { + b: &'a Cell, } #[unsafe_destructor] -impl Drop for r { +impl<'a> Drop for r<'a> { fn drop(&mut self) { self.b.set(self.b.get() + 1); } } -fn r(b: Gc>) -> r { +fn r(b: &Cell) -> r { r { b: b } } pub fn main() { - let b = box(GC) Cell::new(0); + let b = &Cell::new(0); { let _p = Some(r(b)); } diff --git a/src/test/run-pass/issue-980.rs b/src/test/run-pass/issue-980.rs deleted file mode 100644 index 1083f1b3c71..00000000000 --- a/src/test/run-pass/issue-980.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::cell::RefCell; -use std::gc::{Gc, GC}; - -enum maybe_pointy { - no_pointy, - yes_pointy(Gc>), -} - -struct Pointy { - x: maybe_pointy -} - -pub fn main() { - let m = box(GC) RefCell::new(Pointy { x : no_pointy }); - *m.borrow_mut() = Pointy { - x: yes_pointy(m) - }; -} diff --git a/src/test/run-pass/leak-box-as-tydesc.rs b/src/test/run-pass/leak-box-as-tydesc.rs deleted file mode 100644 index 57b9b2494f5..00000000000 --- a/src/test/run-pass/leak-box-as-tydesc.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -fn leaky(_t: T) { } - -pub fn main() { let x = box(GC) 10; leaky::>(x); } diff --git a/src/test/run-pass/leak-tag-copy.rs b/src/test/run-pass/leak-tag-copy.rs deleted file mode 100644 index 3be122b38fa..00000000000 --- a/src/test/run-pass/leak-tag-copy.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(dead_assignment)] -#![allow(unused_variable)] - -use std::gc::{Gc, GC}; - -enum t { a, b(Gc), } - -pub fn main() { let mut x = b(box(GC) 10); x = a; } diff --git a/src/test/run-pass/list.rs b/src/test/run-pass/list.rs index bbb3ce2f2e1..7d0778b6859 100644 --- a/src/test/run-pass/list.rs +++ b/src/test/run-pass/list.rs @@ -9,8 +9,6 @@ // except according to those terms. -use std::gc::{Gc, GC}; +enum list { cons(int, Box), nil, } -enum list { cons(int, Gc), nil, } - -pub fn main() { cons(10, box(GC) cons(11, box(GC) cons(12, box(GC) nil))); } +pub fn main() { cons(10, box cons(11, box cons(12, box nil))); } diff --git a/src/test/run-pass/mlist.rs b/src/test/run-pass/mlist.rs deleted file mode 100644 index ee91ae124b8..00000000000 --- a/src/test/run-pass/mlist.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -enum mlist { cons(int, Gc), nil, } - -pub fn main() { cons(10, box(GC) cons(11, box(GC) cons(12, box(GC) nil))); } diff --git a/src/test/run-pass/move-1.rs b/src/test/run-pass/move-1.rs deleted file mode 100644 index 6f4ffa51a46..00000000000 --- a/src/test/run-pass/move-1.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -struct Triple { x: int, y: int, z: int } - -fn test(x: bool, foo: Gc) -> int { - let bar = foo; - let mut y: Gc; - y = bar; - if x { y = bar; } else { y = box(GC) Triple{x: 4, y: 5, z: 6}; } - return y.y; -} - -pub fn main() { - let x = box(GC) Triple {x: 1, y: 2, z: 3}; - assert_eq!(test(true, x), 2); - assert_eq!(test(true, x), 2); - assert_eq!(test(true, x), 2); - assert_eq!(test(false, x), 5); -} diff --git a/src/test/run-pass/move-2.rs b/src/test/run-pass/move-2.rs index bcc67738dd4..04540c2f35b 100644 --- a/src/test/run-pass/move-2.rs +++ b/src/test/run-pass/move-2.rs @@ -9,8 +9,6 @@ // except according to those terms. -use std::gc::GC; - struct X { x: int, y: int, z: int } -pub fn main() { let x = box(GC) X {x: 1, y: 2, z: 3}; let y = x; assert!((y.y == 2)); } +pub fn main() { let x = box X {x: 1, y: 2, z: 3}; let y = x; assert!((y.y == 2)); } diff --git a/src/test/run-pass/move-3.rs b/src/test/run-pass/move-3.rs deleted file mode 100644 index 21a7d57b563..00000000000 --- a/src/test/run-pass/move-3.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -struct Triple { x: int, y: int, z: int } - -fn test(x: bool, foo: Gc) -> int { - let bar = foo; - let mut y: Gc; - if x { y = bar; } else { y = box(GC) Triple{x: 4, y: 5, z: 6}; } - return y.y; -} - -pub fn main() { - let x = box(GC) Triple{x: 1, y: 2, z: 3}; - for _i in range(0u, 10000u) { - assert_eq!(test(true, x), 2); - } - assert_eq!(test(false, x), 5); -} diff --git a/src/test/run-pass/move-4.rs b/src/test/run-pass/move-4.rs index 984cef55998..5e5d01ae6ee 100644 --- a/src/test/run-pass/move-4.rs +++ b/src/test/run-pass/move-4.rs @@ -9,11 +9,9 @@ // except according to those terms. -use std::gc::{GC, Gc}; - struct Triple { a: int, b: int, c: int } -fn test(foo: Gc) -> Gc { +fn test(foo: Box) -> Box { let foo = foo; let bar = foo; let baz = bar; @@ -22,7 +20,7 @@ fn test(foo: Gc) -> Gc { } pub fn main() { - let x = box(GC) Triple{a: 1, b: 2, c: 3}; + let x = box Triple{a: 1, b: 2, c: 3}; let y = test(x); assert_eq!(y.c, 3); } diff --git a/src/test/run-pass/move-arg-2.rs b/src/test/run-pass/move-arg-2.rs index d00cdcca3e3..840a3c2a6ee 100644 --- a/src/test/run-pass/move-arg-2.rs +++ b/src/test/run-pass/move-arg-2.rs @@ -9,15 +9,13 @@ // except according to those terms. -use std::gc::{Gc, GC}; - -fn test(foo: Gc>) { assert!((*foo.get(0) == 10)); } +fn test(foo: Box>) { assert!((*foo.get(0) == 10)); } pub fn main() { - let x = box(GC) vec!(10); + let x = box vec!(10); // Test forgetting a local by move-in test(x); // Test forgetting a temporary by move-in. - test(box(GC) vec!(10)); + test(box vec!(10)); } diff --git a/src/test/run-pass/mutable-vec-drop.rs b/src/test/run-pass/mutable-vec-drop.rs deleted file mode 100644 index 665303ac487..00000000000 --- a/src/test/run-pass/mutable-vec-drop.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(unused_mut)] - -use std::gc::{Gc, GC}; - -struct Pair { a: int, b: int} - -pub fn main() { - // This just tests whether the vec leaks its members. - let mut _pvec: Vec> = - vec!(box(GC) Pair{a: 1, b: 2}, - box(GC) Pair{a: 3, b: 4}, - box(GC) Pair{a: 5, b: 6}); -} diff --git a/src/test/run-pass/mutual-recursion-group.rs b/src/test/run-pass/mutual-recursion-group.rs index 18f332dbb97..8444a632fe8 100644 --- a/src/test/run-pass/mutual-recursion-group.rs +++ b/src/test/run-pass/mutual-recursion-group.rs @@ -9,14 +9,12 @@ // except according to those terms. -use std::gc::Gc; - enum colour { red, green, blue, } -enum tree { children(Gc), leaf(colour), } +enum tree { children(Box), leaf(colour), } -enum list { cons(Gc, Gc), nil, } +enum list { cons(Box, Box), nil, } -enum small_list { kons(int, Gc), neel, } +enum small_list { kons(int, Box), neel, } pub fn main() { } diff --git a/src/test/run-pass/new-box-syntax.rs b/src/test/run-pass/new-box-syntax.rs index f61a8837e2c..991d0ecdc87 100644 --- a/src/test/run-pass/new-box-syntax.rs +++ b/src/test/run-pass/new-box-syntax.rs @@ -11,9 +11,8 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -// Tests that the new `box` syntax works with unique pointers and GC pointers. +// Tests that the new `box` syntax works with unique pointers. -use std::gc::{Gc, GC}; use std::boxed::{Box, HEAP}; struct Structure { @@ -24,12 +23,6 @@ struct Structure { pub fn main() { let x: Box = box(HEAP) 2i; let y: Box = box 2i; - let z: Gc = box(GC) 2i; - let a: Gc = box(GC) Structure { - x: 10, - y: 20, - }; let b: Box = box()(1i + 2); let c = box()(3i + 4); - let d = box(GC)(5i + 6); } diff --git a/src/test/run-pass/newtype-struct-drop-run.rs b/src/test/run-pass/newtype-struct-drop-run.rs index 50971806a87..8c35abad7f1 100644 --- a/src/test/run-pass/newtype-struct-drop-run.rs +++ b/src/test/run-pass/newtype-struct-drop-run.rs @@ -13,12 +13,11 @@ // Make sure the destructor is run for newtype structs. use std::cell::Cell; -use std::gc::{Gc, GC}; -struct Foo(Gc>); +struct Foo<'a>(&'a Cell); #[unsafe_destructor] -impl Drop for Foo { +impl<'a> Drop for Foo<'a> { fn drop(&mut self) { let Foo(i) = *self; i.set(23); @@ -26,7 +25,7 @@ fn drop(&mut self) { } pub fn main() { - let y = box(GC) Cell::new(32); + let y = &Cell::new(32); { let _x = Foo(y); } diff --git a/src/test/run-pass/nullable-pointer-iotareduction.rs b/src/test/run-pass/nullable-pointer-iotareduction.rs index a7d52b87e55..0c66b139e7c 100644 --- a/src/test/run-pass/nullable-pointer-iotareduction.rs +++ b/src/test/run-pass/nullable-pointer-iotareduction.rs @@ -11,7 +11,6 @@ #![feature(macro_rules)] use std::{option, mem}; -use std::gc::{Gc, GC}; // Iota-reduction is a rule in the Calculus of (Co-)Inductive Constructions, // which "says that a destructor applied to an object built from a constructor @@ -76,7 +75,6 @@ fn get_ref(&self) -> (int, &T) { pub fn main() { check_type!(&17: &int); check_type!(box 18: Box); - check_type!(box(GC) 19: Gc); check_type!("foo".to_string(): String); check_type!(vec!(20, 22): Vec ); let mint: uint = unsafe { mem::transmute(main) }; diff --git a/src/test/run-pass/nullable-pointer-size.rs b/src/test/run-pass/nullable-pointer-size.rs index 9dd65bdcb26..5708310abad 100644 --- a/src/test/run-pass/nullable-pointer-size.rs +++ b/src/test/run-pass/nullable-pointer-size.rs @@ -11,7 +11,6 @@ #![feature(macro_rules)] use std::mem; -use std::gc::Gc; enum E { Thing(int, T), Nothing((), ((), ()), [i8, ..0]) } struct S(int, T); @@ -40,6 +39,5 @@ enum E { Thing(int, T), Nothing((), ((), ()), [i8, ..0]) } pub fn main() { check_type!(&'static int); check_type!(Box); - check_type!(Gc); check_type!(extern fn()); } diff --git a/src/test/run-pass/objects-owned-object-borrowed-method-header.rs b/src/test/run-pass/objects-owned-object-borrowed-method-header.rs deleted file mode 100644 index 60c46d17b06..00000000000 --- a/src/test/run-pass/objects-owned-object-borrowed-method-header.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{Gc, GC}; - -// Test invoked `&self` methods on owned objects where the values -// closed over contain managed values. This implies that the boxes -// will have headers that must be skipped over. - -trait FooTrait { - fn foo(&self) -> uint; -} - -struct BarStruct { - x: Gc -} - -impl FooTrait for BarStruct { - fn foo(&self) -> uint { - *self.x - } -} - -pub fn main() { - let foos: Vec> = vec!( - box BarStruct{ x: box(GC) 0 } as Box, - box BarStruct{ x: box(GC) 1 } as Box, - box BarStruct{ x: box(GC) 2 } as Box - ); - - for i in range(0u, foos.len()) { - assert_eq!(i, foos.get(i).foo()); - } -} diff --git a/src/test/run-pass/option-unwrap.rs b/src/test/run-pass/option-unwrap.rs index a6730d67ce0..8bdae89e523 100644 --- a/src/test/run-pass/option-unwrap.rs +++ b/src/test/run-pass/option-unwrap.rs @@ -11,16 +11,14 @@ #![feature(unsafe_destructor)] use std::cell::Cell; -use std::gc::{GC, Gc}; -struct dtor { - x: Gc>, +struct dtor<'a> { + x: &'a Cell, } #[unsafe_destructor] -impl Drop for dtor { +impl<'a> Drop for dtor<'a> { fn drop(&mut self) { - // abuse access to shared mutable state to write this code self.x.set(self.x.get() - 1); } } @@ -33,7 +31,7 @@ fn unwrap(o: Option) -> T { } pub fn main() { - let x = box(GC) Cell::new(1); + let x = &Cell::new(1); { let b = Some(dtor { x:x }); diff --git a/src/test/run-pass/output-slot-variants.rs b/src/test/run-pass/output-slot-variants.rs index 34dccb81865..8a10cc8c1ef 100644 --- a/src/test/run-pass/output-slot-variants.rs +++ b/src/test/run-pass/output-slot-variants.rs @@ -11,30 +11,28 @@ #![allow(dead_assignment)] #![allow(unused_variable)] -use std::gc::{Gc, GC}; - struct A { a: int, b: int } -struct Abox { a: Gc, b: Gc } +struct Abox { a: Box, b: Box } -fn ret_int_i() -> int { return 10; } +fn ret_int_i() -> int { 10 } -fn ret_ext_i() -> Gc { return box(GC) 10; } +fn ret_ext_i() -> Box { box 10 } -fn ret_int_rec() -> A { return A {a: 10, b: 10}; } +fn ret_int_rec() -> A { A {a: 10, b: 10} } -fn ret_ext_rec() -> Gc { return box(GC) A {a: 10, b: 10}; } +fn ret_ext_rec() -> Box { box A {a: 10, b: 10} } -fn ret_ext_mem() -> Abox { return Abox {a: box(GC) 10, b: box(GC) 10}; } +fn ret_ext_mem() -> Abox { Abox {a: box 10, b: box 10} } -fn ret_ext_ext_mem() -> Gc { box(GC) Abox{a: box(GC) 10, b: box(GC) 10} } +fn ret_ext_ext_mem() -> Box { box Abox{a: box 10, b: box 10} } pub fn main() { let mut int_i: int; - let mut ext_i: Gc; + let mut ext_i: Box; let mut int_rec: A; - let mut ext_rec: Gc; + let mut ext_rec: Box; let mut ext_mem: Abox; - let mut ext_ext_mem: Gc; + let mut ext_ext_mem: Box; int_i = ret_int_i(); // initializing int_i = ret_int_i(); // non-initializing diff --git a/src/test/run-pass/packed-struct-size.rs b/src/test/run-pass/packed-struct-size.rs index cfea444d7ff..e6bfc8ec1a5 100644 --- a/src/test/run-pass/packed-struct-size.rs +++ b/src/test/run-pass/packed-struct-size.rs @@ -10,7 +10,6 @@ use std::mem; -use std::gc::Gc; #[repr(packed)] struct S4 { @@ -48,7 +47,7 @@ struct S7_Option { a: f32, b: u8, c: u16, - d: Option> + d: Option> } // Placing packed structs in statics should work @@ -62,5 +61,5 @@ pub fn main() { assert_eq!(mem::size_of::(), 5); assert_eq!(mem::size_of::(), 13); assert_eq!(mem::size_of::(), 3 + mem::size_of::()); - assert_eq!(mem::size_of::(), 7 + mem::size_of::>>()); + assert_eq!(mem::size_of::(), 7 + mem::size_of::>>()); } diff --git a/src/test/run-pass/packed-tuple-struct-size.rs b/src/test/run-pass/packed-tuple-struct-size.rs index f23166288fb..8967b07ca88 100644 --- a/src/test/run-pass/packed-tuple-struct-size.rs +++ b/src/test/run-pass/packed-tuple-struct-size.rs @@ -9,7 +9,6 @@ // except according to those terms. -use std::gc::Gc; use std::mem; #[repr(packed)] @@ -30,7 +29,7 @@ enum Foo { struct S3_Foo(u8, u16, Foo); #[repr(packed)] -struct S7_Option(f32, u8, u16, Option>); +struct S7_Option(f32, u8, u16, Option>); pub fn main() { assert_eq!(mem::size_of::(), 4); @@ -43,5 +42,5 @@ pub fn main() { 3 + mem::size_of::()); assert_eq!(mem::size_of::(), - 7 + mem::size_of::>>()); + 7 + mem::size_of::>>()); } diff --git a/src/test/run-pass/pass-by-copy.rs b/src/test/run-pass/pass-by-copy.rs deleted file mode 100644 index 88209192422..00000000000 --- a/src/test/run-pass/pass-by-copy.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -extern crate debug; - -use std::gc::{GC, Gc}; - -fn magic(x: A) { println!("{:?}", x); } -fn magic2(x: Gc) { println!("{:?}", x); } - -struct A { a: Gc } - -pub fn main() { - let a = A {a: box(GC) 10}; - let b = box(GC) 10; - magic(a); magic(A {a: box(GC) 20}); - magic2(b); magic2(box(GC) 20); -} diff --git a/src/test/run-pass/rcvr-borrowed-to-region.rs b/src/test/run-pass/rcvr-borrowed-to-region.rs index b856386e1d3..8ad2dbc1acb 100644 --- a/src/test/run-pass/rcvr-borrowed-to-region.rs +++ b/src/test/run-pass/rcvr-borrowed-to-region.rs @@ -9,8 +9,6 @@ // except according to those terms. -use std::gc::GC; - trait get { fn get(self) -> int; } @@ -25,15 +23,6 @@ fn get(self) -> int { } pub fn main() { - let x = box(GC) 6; - let y = x.get(); - assert_eq!(y, 6); - - let x = box(GC) 6; - let y = x.get(); - println!("y={}", y); - assert_eq!(y, 6); - let x = box 6; let y = x.get(); println!("y={}", y); diff --git a/src/test/run-pass/regions-borrow-at.rs b/src/test/run-pass/regions-borrow-at.rs index 15206f1c386..9a758c5d8ad 100644 --- a/src/test/run-pass/regions-borrow-at.rs +++ b/src/test/run-pass/regions-borrow-at.rs @@ -9,14 +9,12 @@ // except according to those terms. -use std::gc::GC; - fn foo(x: &uint) -> uint { *x } pub fn main() { - let p = box(GC) 22u; + let p = box 22u; let r = foo(&*p); println!("r={}", r); assert_eq!(r, 22u); diff --git a/src/test/run-pass/regions-escape-into-other-fn.rs b/src/test/run-pass/regions-escape-into-other-fn.rs index 09d9008c0b6..5b0b7cc5b4e 100644 --- a/src/test/run-pass/regions-escape-into-other-fn.rs +++ b/src/test/run-pass/regions-escape-into-other-fn.rs @@ -9,12 +9,10 @@ // except according to those terms. -use std::gc::GC; - fn foo(x: &uint) -> &uint { x } fn bar(x: &uint) -> uint { *x } pub fn main() { - let p = box(GC) 3u; + let p = box 3u; assert_eq!(bar(foo(&*p)), 3); } diff --git a/src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs b/src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs index 4d4417189c9..1ecaf41702e 100644 --- a/src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs +++ b/src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs @@ -8,12 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::gc::GC; - fn borrow(x: &T) -> &T {x} pub fn main() { - let x = box(GC) 3i; + let x = box 3i; loop { let y = borrow(&*x); assert_eq!(*x, *y); diff --git a/src/test/run-pass/regions-infer-borrow-scope.rs b/src/test/run-pass/regions-infer-borrow-scope.rs index 4c021b18ad8..d3dbca53f60 100644 --- a/src/test/run-pass/regions-infer-borrow-scope.rs +++ b/src/test/run-pass/regions-infer-borrow-scope.rs @@ -9,8 +9,6 @@ // except according to those terms. -use std::gc::GC; - struct Point {x: int, y: int} fn x_coord(p: &Point) -> &int { @@ -18,7 +16,7 @@ fn x_coord(p: &Point) -> &int { } pub fn main() { - let p = box(GC) Point {x: 3, y: 4}; + let p = box Point {x: 3, y: 4}; let xc = x_coord(&*p); assert_eq!(*xc, 3); } diff --git a/src/test/run-pass/resource-assign-is-not-copy.rs b/src/test/run-pass/resource-assign-is-not-copy.rs index 48022fefbbd..5ea22ae76c2 100644 --- a/src/test/run-pass/resource-assign-is-not-copy.rs +++ b/src/test/run-pass/resource-assign-is-not-copy.rs @@ -10,36 +10,34 @@ #![feature(unsafe_destructor)] -extern crate debug; - use std::cell::Cell; -use std::gc::{Gc, GC}; -struct r { - i: Gc>, +#[deriving(Show)] +struct r<'a> { + i: &'a Cell, } #[unsafe_destructor] -impl Drop for r { +impl<'a> Drop for r<'a> { fn drop(&mut self) { self.i.set(self.i.get() + 1); } } -fn r(i: Gc>) -> r { +fn r(i: &Cell) -> r { r { i: i } } pub fn main() { - let i = box(GC) Cell::new(0i); + let i = &Cell::new(0i); // Even though these look like copies, they are guaranteed not to be { let a = r(i); let b = (a, 10i); let (c, _d) = b; - println!("{:?}", c); + println!("{}", c); } assert_eq!(i.get(), 1); } diff --git a/src/test/run-pass/resource-destruct.rs b/src/test/run-pass/resource-destruct.rs index ba6a285d652..71bf6cc6261 100644 --- a/src/test/run-pass/resource-destruct.rs +++ b/src/test/run-pass/resource-destruct.rs @@ -11,31 +11,30 @@ #![feature(unsafe_destructor)] use std::cell::Cell; -use std::gc::{GC, Gc}; -struct shrinky_pointer { - i: Gc>>, +struct shrinky_pointer<'a> { + i: &'a Cell, } #[unsafe_destructor] -impl Drop for shrinky_pointer { +impl<'a> Drop for shrinky_pointer<'a> { fn drop(&mut self) { println!("Hello!"); self.i.set(self.i.get() - 1); } } -impl shrinky_pointer { +impl<'a> shrinky_pointer<'a> { pub fn look_at(&self) -> int { return self.i.get(); } } -fn shrinky_pointer(i: Gc>>) -> shrinky_pointer { +fn shrinky_pointer(i: &Cell) -> shrinky_pointer { shrinky_pointer { i: i } } pub fn main() { - let my_total = box(GC) box(GC) Cell::new(10); + let my_total = &Cell::new(10); { let pt = shrinky_pointer(my_total); assert!((pt.look_at() == 10)); } println!("my_total = {}", my_total.get()); assert_eq!(my_total.get(), 9); diff --git a/src/test/run-pass/resource-in-struct.rs b/src/test/run-pass/resource-in-struct.rs index fd1efe1a20e..8e798fc6a0d 100644 --- a/src/test/run-pass/resource-in-struct.rs +++ b/src/test/run-pass/resource-in-struct.rs @@ -14,17 +14,16 @@ // variant use std::cell::Cell; -use std::gc::{Gc, GC}; -type closable = Gc>; +type closable<'a> = &'a Cell; -struct close_res { - i: closable, +struct close_res<'a> { + i: closable<'a>, } #[unsafe_destructor] -impl Drop for close_res { +impl<'a> Drop for close_res<'a> { fn drop(&mut self) { self.i.set(false); } @@ -41,7 +40,7 @@ enum option { none, some(T), } fn sink(_res: option) { } pub fn main() { - let c = box(GC) Cell::new(true); + let c = &Cell::new(true); sink(none); sink(some(close_res(c))); assert!(!c.get()); diff --git a/src/test/run-pass/shape_intrinsic_tag_then_rec.rs b/src/test/run-pass/shape_intrinsic_tag_then_rec.rs index b58db67c0ac..2d6da26df52 100644 --- a/src/test/run-pass/shape_intrinsic_tag_then_rec.rs +++ b/src/test/run-pass/shape_intrinsic_tag_then_rec.rs @@ -9,30 +9,26 @@ // except according to those terms. -extern crate debug; - // Exercises a bug in the shape code that was exposed // on x86_64: when there is an enum embedded in an // interior record which is then itself interior to // something else, shape calculations were off. -use std::gc::{Gc, GC}; - -#[deriving(Clone)] +#[deriving(Clone, Show)] enum opt_span { //hack (as opposed to option), to make `span` compile os_none, - os_some(Gc), + os_some(Box), } -#[deriving(Clone)] +#[deriving(Clone, Show)] struct Span { lo: uint, hi: uint, expanded_from: opt_span, } -#[deriving(Clone)] +#[deriving(Clone, Show)] struct Spanned { data: T, span: Span, @@ -40,17 +36,17 @@ struct Spanned { type ty_ = uint; -#[deriving(Clone)] +#[deriving(Clone, Show)] struct Path_ { global: bool, idents: Vec , - types: Vec>, + types: Vec>, } type path = Spanned; type ty = Spanned; -#[deriving(Clone)] +#[deriving(Clone, Show)] struct X { sp: Span, path: path, @@ -58,14 +54,14 @@ struct X { pub fn main() { let sp: Span = Span {lo: 57451u, hi: 57542u, expanded_from: os_none}; - let t: Gc = box(GC) Spanned { data: 3u, span: sp }; + let t: Box = box Spanned { data: 3u, span: sp.clone() }; let p_: Path_ = Path_ { global: true, idents: vec!("hi".to_string()), types: vec!(t), }; - let p: path = Spanned { data: p_, span: sp }; + let p: path = Spanned { data: p_, span: sp.clone() }; let x = X { sp: sp, path: p }; - println!("{:?}", x.path.clone()); - println!("{:?}", x.clone()); + println!("{}", x.path.clone()); + println!("{}", x.clone()); } diff --git a/src/test/run-pass/terminate-in-initializer.rs b/src/test/run-pass/terminate-in-initializer.rs index fcce05a7b09..41a9e6e53f2 100644 --- a/src/test/run-pass/terminate-in-initializer.rs +++ b/src/test/run-pass/terminate-in-initializer.rs @@ -13,22 +13,21 @@ // Don't try to clean up uninitialized locals use std::task; -use std::gc::{Gc}; -fn test_break() { loop { let _x: Gc = break; } } +fn test_break() { loop { let _x: Box = break; } } -fn test_cont() { let mut i = 0i; while i < 1 { i += 1; let _x: Gc = continue; } } +fn test_cont() { let mut i = 0i; while i < 1 { i += 1; let _x: Box = continue; } } -fn test_ret() { let _x: Gc = return; } +fn test_ret() { let _x: Box = return; } fn test_fail() { - fn f() { let _x: Gc = fail!(); } + fn f() { let _x: Box = fail!(); } task::try(proc() f() ); } fn test_fail_indirect() { fn f() -> ! { fail!(); } - fn g() { let _x: Gc = f(); } + fn g() { let _x: Box = f(); } task::try(proc() g() ); } diff --git a/src/test/run-pass/trait-cast.rs b/src/test/run-pass/trait-cast.rs deleted file mode 100644 index 30acf07ae60..00000000000 --- a/src/test/run-pass/trait-cast.rs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-pretty FIXME(#14193) - - -// Test cyclic detector when using trait instances. - -use std::cell::RefCell; -use std::gc::{GC, Gc}; - -struct Tree(Gc>); -struct TreeR { - left: Option, - right: Option, - val: Box -} - -trait to_str { - fn to_str_(&self) -> String; -} - -impl to_str for Option { - fn to_str_(&self) -> String { - match *self { - None => { "none".to_string() } - Some(ref t) => format!("some({})", t.to_str_()), - } - } -} - -impl to_str for int { - fn to_str_(&self) -> String { - self.to_string() - } -} - -impl to_str for Tree { - fn to_str_(&self) -> String { - let Tree(t) = *self; - let this = t.borrow(); - let (l, r) = (this.left, this.right); - let val = &this.val; - format!("[{}, {}, {}]", val.to_str_(), l.to_str_(), r.to_str_()) - } -} - -fn foo(x: T) -> String { x.to_str_() } - -pub fn main() { - let t1 = Tree(box(GC) RefCell::new(TreeR{left: None, - right: None, - val: box 1i as Box})); - let t2 = Tree(box(GC) RefCell::new(TreeR{left: Some(t1), - right: Some(t1), - val: box 2i as Box})); - let expected = - "[2, some([1, none, none]), some([1, none, none])]".to_string(); - assert!(t2.to_str_() == expected); - assert!(foo(t2) == expected); - - { - let Tree(t1_) = t1; - let mut t1 = t1_.borrow_mut(); - t1.left = Some(t2); // create cycle - } -} diff --git a/src/test/run-pass/type-param-constraints.rs b/src/test/run-pass/type-param-constraints.rs index 41a8ca33a2a..7265ddf6615 100644 --- a/src/test/run-pass/type-param-constraints.rs +++ b/src/test/run-pass/type-param-constraints.rs @@ -9,8 +9,6 @@ // except according to those terms. -use std::gc::GC; - fn p_foo(_pinned: T) { } fn s_foo(_shared: T) { } fn u_foo(_unique: T) { } @@ -31,15 +29,11 @@ fn r(i:int) -> r { pub fn main() { p_foo(r(10)); - p_foo(box(GC) r(10)); p_foo(box r(10)); - p_foo(box(GC) 10i); p_foo(box 10i); p_foo(10i); - s_foo(box(GC) r(10)); - s_foo(box(GC) 10i); s_foo(box 10i); s_foo(10i); diff --git a/src/test/run-pass/typeclasses-eq-example-static.rs b/src/test/run-pass/typeclasses-eq-example-static.rs index 0cd6210e13c..6d8e7d1aaf3 100644 --- a/src/test/run-pass/typeclasses-eq-example-static.rs +++ b/src/test/run-pass/typeclasses-eq-example-static.rs @@ -12,17 +12,15 @@ // Example from lkuper's intern talk, August 2012 -- now with static // methods! -use std::gc::{GC, Gc}; - trait Equal { - fn isEq(a: Self, b: Self) -> bool; + fn isEq(a: &Self, b: &Self) -> bool; } enum Color { cyan, magenta, yellow, black } impl Equal for Color { - fn isEq(a: Color, b: Color) -> bool { - match (a, b) { + fn isEq(a: &Color, b: &Color) -> bool { + match (*a, *b) { (cyan, cyan) => { true } (magenta, magenta) => { true } (yellow, yellow) => { true } @@ -34,15 +32,15 @@ fn isEq(a: Color, b: Color) -> bool { enum ColorTree { leaf(Color), - branch(Gc, Gc) + branch(Box, Box) } impl Equal for ColorTree { - fn isEq(a: ColorTree, b: ColorTree) -> bool { + fn isEq(a: &ColorTree, b: &ColorTree) -> bool { match (a, b) { - (leaf(x), leaf(y)) => { Equal::isEq(x, y) } - (branch(l1, r1), branch(l2, r2)) => { - Equal::isEq(*l1, *l2) && Equal::isEq(*r1, *r2) + (&leaf(x), &leaf(y)) => { Equal::isEq(&x, &y) } + (&branch(ref l1, ref r1), &branch(ref l2, ref r2)) => { + Equal::isEq(&**l1, &**l2) && Equal::isEq(&**r1, &**r2) } _ => { false } } @@ -50,19 +48,19 @@ fn isEq(a: ColorTree, b: ColorTree) -> bool { } pub fn main() { - assert!(Equal::isEq(cyan, cyan)); - assert!(Equal::isEq(magenta, magenta)); - assert!(!Equal::isEq(cyan, yellow)); - assert!(!Equal::isEq(magenta, cyan)); + assert!(Equal::isEq(&cyan, &cyan)); + assert!(Equal::isEq(&magenta, &magenta)); + assert!(!Equal::isEq(&cyan, &yellow)); + assert!(!Equal::isEq(&magenta, &cyan)); - assert!(Equal::isEq(leaf(cyan), leaf(cyan))); - assert!(!Equal::isEq(leaf(cyan), leaf(yellow))); + assert!(Equal::isEq(&leaf(cyan), &leaf(cyan))); + assert!(!Equal::isEq(&leaf(cyan), &leaf(yellow))); - assert!(Equal::isEq(branch(box(GC) leaf(magenta), box(GC) leaf(cyan)), - branch(box(GC) leaf(magenta), box(GC) leaf(cyan)))); + assert!(Equal::isEq(&branch(box leaf(magenta), box leaf(cyan)), + &branch(box leaf(magenta), box leaf(cyan)))); - assert!(!Equal::isEq(branch(box(GC) leaf(magenta), box(GC) leaf(cyan)), - branch(box(GC) leaf(magenta), box(GC) leaf(magenta)))); + assert!(!Equal::isEq(&branch(box leaf(magenta), box leaf(cyan)), + &branch(box leaf(magenta), box leaf(magenta)))); println!("Assertions all succeeded!"); } diff --git a/src/test/run-pass/typeclasses-eq-example.rs b/src/test/run-pass/typeclasses-eq-example.rs index 0a77824cf47..cbb85b2b7b8 100644 --- a/src/test/run-pass/typeclasses-eq-example.rs +++ b/src/test/run-pass/typeclasses-eq-example.rs @@ -11,17 +11,15 @@ // Example from lkuper's intern talk, August 2012. -use std::gc::{GC, Gc}; - trait Equal { - fn isEq(&self, a: Self) -> bool; + fn isEq(&self, a: &Self) -> bool; } enum Color { cyan, magenta, yellow, black } impl Equal for Color { - fn isEq(&self, a: Color) -> bool { - match (*self, a) { + fn isEq(&self, a: &Color) -> bool { + match (*self, *a) { (cyan, cyan) => { true } (magenta, magenta) => { true } (yellow, yellow) => { true } @@ -33,15 +31,15 @@ fn isEq(&self, a: Color) -> bool { enum ColorTree { leaf(Color), - branch(Gc, Gc) + branch(Box, Box) } impl Equal for ColorTree { - fn isEq(&self, a: ColorTree) -> bool { - match (*self, a) { - (leaf(x), leaf(y)) => { x.isEq(y) } - (branch(l1, r1), branch(l2, r2)) => { - (*l1).isEq(*l2) && (*r1).isEq(*r2) + fn isEq(&self, a: &ColorTree) -> bool { + match (self, a) { + (&leaf(x), &leaf(y)) => { x.isEq(&y) } + (&branch(ref l1, ref r1), &branch(ref l2, ref r2)) => { + (&**l1).isEq(&**l2) && (&**r1).isEq(&**r2) } _ => { false } } @@ -49,19 +47,19 @@ fn isEq(&self, a: ColorTree) -> bool { } pub fn main() { - assert!(cyan.isEq(cyan)); - assert!(magenta.isEq(magenta)); - assert!(!cyan.isEq(yellow)); - assert!(!magenta.isEq(cyan)); + assert!(cyan.isEq(&cyan)); + assert!(magenta.isEq(&magenta)); + assert!(!cyan.isEq(&yellow)); + assert!(!magenta.isEq(&cyan)); - assert!(leaf(cyan).isEq(leaf(cyan))); - assert!(!leaf(cyan).isEq(leaf(yellow))); + assert!(leaf(cyan).isEq(&leaf(cyan))); + assert!(!leaf(cyan).isEq(&leaf(yellow))); - assert!(branch(box(GC) leaf(magenta), box(GC) leaf(cyan)) - .isEq(branch(box(GC) leaf(magenta), box(GC) leaf(cyan)))); + assert!(branch(box leaf(magenta), box leaf(cyan)) + .isEq(&branch(box leaf(magenta), box leaf(cyan)))); - assert!(!branch(box(GC) leaf(magenta), box(GC) leaf(cyan)) - .isEq(branch(box(GC) leaf(magenta), box(GC) leaf(magenta)))); + assert!(!branch(box leaf(magenta), box leaf(cyan)) + .isEq(&branch(box leaf(magenta), box leaf(magenta)))); println!("Assertions all succeeded!"); } diff --git a/src/test/run-pass/uniq-cc-generic.rs b/src/test/run-pass/uniq-cc-generic.rs deleted file mode 100644 index e342dcb365d..00000000000 --- a/src/test/run-pass/uniq-cc-generic.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-pretty FIXME(#14193) - - -use std::cell::RefCell; -use std::gc::{Gc, GC}; - -enum maybe_pointy { - none, - p(Gc>), -} - -struct Pointy { - a : maybe_pointy, - d : proc():Send -> uint, -} - -fn make_uniq_closure(a: A) -> proc():Send -> uint { - proc() { &a as *const A as uint } -} - -fn empty_pointy() -> Gc> { - return box(GC) RefCell::new(Pointy { - a : none, - d : make_uniq_closure("hi".to_string()) - }) -} - -pub fn main() { - let v = empty_pointy(); - { - let mut vb = v.borrow_mut(); - vb.a = p(v); - } -} diff --git a/src/test/run-pass/uniq-cc.rs b/src/test/run-pass/uniq-cc.rs deleted file mode 100644 index c7aca64c7cb..00000000000 --- a/src/test/run-pass/uniq-cc.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::cell::RefCell; -use std::gc::{Gc, GC}; - -enum maybe_pointy { - none, - p(Gc>), -} - -struct Pointy { - a : maybe_pointy, - c : Box, - d : proc():Send->(), -} - -fn empty_pointy() -> Gc> { - return box(GC) RefCell::new(Pointy { - a : none, - c : box 22, - d : proc() {}, - }) -} - -pub fn main() { - let v = empty_pointy(); - { - let mut vb = v.borrow_mut(); - vb.a = p(v); - } -} diff --git a/src/test/run-pass/unique-assign-generic.rs b/src/test/run-pass/unique-assign-generic.rs index 478565c86fd..493ec8ddc20 100644 --- a/src/test/run-pass/unique-assign-generic.rs +++ b/src/test/run-pass/unique-assign-generic.rs @@ -9,8 +9,6 @@ // except according to those terms. -use std::gc::GC; - fn f(t: T) -> T { let t1 = t; t1 @@ -19,6 +17,4 @@ fn f(t: T) -> T { pub fn main() { let t = f(box 100i); assert_eq!(t, box 100i); - let t = f(box box(GC) vec!(100i)); - assert_eq!(t, box box(GC) vec!(100i)); } diff --git a/src/test/run-pass/unwind-box.rs b/src/test/run-pass/unwind-box.rs deleted file mode 100644 index 70c8c5b64e4..00000000000 --- a/src/test/run-pass/unwind-box.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::task; -use std::gc::GC; - -fn f() { - let _a = box(GC) 0i; - fail!(); -} - -pub fn main() { - task::spawn(f); -} diff --git a/src/test/run-pass/unwind-resource2.rs b/src/test/run-pass/unwind-resource2.rs deleted file mode 100644 index 6d04c0e26ad..00000000000 --- a/src/test/run-pass/unwind-resource2.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(unsafe_destructor)] - -use std::task; -use std::gc::{Gc, GC}; - -struct complainer { - c: Gc, -} - -#[unsafe_destructor] -impl Drop for complainer { - fn drop(&mut self) {} -} - -fn complainer(c: Gc) -> complainer { - complainer { - c: c - } -} - -fn f() { - let _c = complainer(box(GC) 0); - fail!(); -} - -pub fn main() { - task::spawn(f); -} diff --git a/src/test/run-pass/vec-drop.rs b/src/test/run-pass/vec-drop.rs deleted file mode 100644 index 6cc95a2e548..00000000000 --- a/src/test/run-pass/vec-drop.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::gc::{GC, Gc}; - -struct Pair { x: int, y: int } - -pub fn main() { - // This just tests whether the vec leaks its members. - - let _pvec: Vec> = - vec!(box(GC) Pair{x: 1, y: 2}, - box(GC) Pair{x: 3, y: 4}, - box(GC) Pair{x: 5, y: 6}); -} diff --git a/src/test/run-pass/vec-slice-drop.rs b/src/test/run-pass/vec-slice-drop.rs index 42132f0a12f..498ec0e8fba 100644 --- a/src/test/run-pass/vec-slice-drop.rs +++ b/src/test/run-pass/vec-slice-drop.rs @@ -11,28 +11,27 @@ #![feature(unsafe_destructor)] use std::cell::Cell; -use std::gc::{Gc, GC}; // Make sure that destructors get run on slice literals -struct foo { - x: Gc>, +struct foo<'a> { + x: &'a Cell, } #[unsafe_destructor] -impl Drop for foo { +impl<'a> Drop for foo<'a> { fn drop(&mut self) { self.x.set(self.x.get() + 1); } } -fn foo(x: Gc>) -> foo { +fn foo(x: &Cell) -> foo { foo { x: x } } pub fn main() { - let x = box(GC) Cell::new(0); + let x = &Cell::new(0); { let l = &[foo(x)]; assert_eq!(l[0].x.get(), 0); diff --git a/src/test/run-pass/weird-exprs.rs b/src/test/run-pass/weird-exprs.rs index e8489e7c386..72204c28f82 100644 --- a/src/test/run-pass/weird-exprs.rs +++ b/src/test/run-pass/weird-exprs.rs @@ -11,7 +11,6 @@ use std::cell::Cell; use std::mem::swap; -use std::gc::{Gc, GC}; // Just a grab bag of stuff that you wouldn't want to actually write. @@ -23,10 +22,10 @@ fn f(_x: ()) { } } fn what() { - fn the(x: Gc>) { + fn the(x: &Cell) { return while !x.get() { x.set(true); }; } - let i = box(GC) Cell::new(false); + let i = &Cell::new(false); let dont = {||the(i)}; dont(); assert!((i.get())); -- GitLab