diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index ec19844a24abd203d4358d668d190889d40d0928..049bf4eb1b02d2103e7ef1baf4ac85483ce794c9 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 0e1c39535bed45e096665300c0c1409ceeb500d4..c9c824ac9cebff78a3bd16e7c58920fd796375d5 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 e84c894796736d249e83ea9fb887b738b1e34988..9e47142478e6b6f9f8c6ce2b9b8314065a703e1c 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 98c01000cb06a71ed3f9746a28203a7ba85e890f..e27816c81653972aec579f2c68c438e20089cf26 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 e7ce5b7dca8cb05f616441053e3efc6c27b4c8db..fcef5981f0a35602c9d4e742130ac59bf1d266db 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 9e88d05884ce920b0025b711addd0ff1c46794fb..ca5f76cf0d45a5122cdea9f84f877fe1d8c388b3 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 b097e688b4272502df2dccb78613a63c10f9e81d..bbaf7991fd3cc5510c99ed9e1a5f1bc7529c2537 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 e9a249001764af6d7e67159ff88ce12bb7be3e8b..5e2a04001b5d6bca59b8ab86bcd2333923925125 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 61c7d3f87dfb76775dfdabd2bdac1cf4dd128eb3..3bedbd9089ce2638f8eb91e220d3cba776a8b527 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 5d56db314b297c13c676cb5e81269185e70a731e..d9d393cc7492c010b247d2759bb15bc2049f94b6 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 ee7787d6fccf56bb02d7f7f6a5b2a1fb3830353a..961dad000914a0dfa3022b5520676bd81ba5e2bf 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 93b22edbf03e63197847809e7b841a994acd5f7e..6729373296b769cf67e450afb34688ad2c997b63 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 276c830cf5d48ba24d0e34110ef67f6f8f1bacc3..7aa3b30ce4919373468783639d78316033c8e4e5 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 91eb20d19ed9385a34c32961d2e9f45b6b622f22..0000000000000000000000000000000000000000 --- 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 a8a79056fb13c21963262cc6115f3c105861e98d..0000000000000000000000000000000000000000 --- 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 ad1ac3cc15ee344a3ea20cff86a6fe7bca275a4d..0000000000000000000000000000000000000000 --- 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 ec52f0588363c73ba40fa9fdf83ae6f536d74d12..0000000000000000000000000000000000000000 --- 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 5aff482a32320fb4f04c427351c1af6e4eb47631..0000000000000000000000000000000000000000 --- 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 6c3c340b97a0a5e190a535dced91b2434f455830..0000000000000000000000000000000000000000 --- 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 2ad042c69c3bb72e7b988ac10a2e7fec69eb8916..0000000000000000000000000000000000000000 --- 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 29ee79b0079c32839a36fa083c3d3cf4a287de2e..0000000000000000000000000000000000000000 --- 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 3e67419843cba283a3c36921e7860af5caca2625..e29be22ca9acc1494cfe3dae5ed86ea28f7fc473 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 06079a5487ff403a663d9cbdeb2dba6445730411..d77c552be034c60850fe070e74c322782773eb28 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 4512eb3f70aceeca7ac618493259cfa83192364b..8cbbfb7b83a55bd1e7abd8d14b2c266fc36c631b 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 577ac480f60dc5f4fb3756d0582e947caca6b5bb..30cf7ee7d8888267f46239842a08331fb9193bbe 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 d3bd17a77420fd5fa40f21e45f65078be2fe28f2..cccf730095bdfad0ba5ad1a0902c717d934322bd 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 9003578a0bb3e744e273aaba9a3f029f8de1b068..73d42aa0de1ad0871493fbb333aa0b558d99e3dd 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 a9e9416beb390c941d92c75f11bc38e3787923c8..c6869c44057f924885e18f2572723d5c7cfe1a52 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 1c0295974c923c8e7dc059da64ed8e7d8e0fbe43..e29b8bc04d80e1a01fd0becdc406587668b073bc 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 3524d11d1842a621e2c05952cb956479a1eddb8c..499144698fb817296d0a5d85203a406cde678c7f 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 e50bb8fbede657c63e537e6d596fa771a392c4eb..26b0c5503e32fac47361f26ddb7b9f0251d77023 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 f292d1599823ffeffc8af60f1747be13d05cc71c..6ca3f0174bb7449c524cd393d06c371074110f44 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 375969ffb5267067e9044b58d7125b97d456dc94..0000000000000000000000000000000000000000 --- 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 0a28242fb1b3a950fb15ef80f013ec3b39c39dc8..0000000000000000000000000000000000000000 --- 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 602ffe2680b04a7c7b79e7263d05810c0bc7d573..0000000000000000000000000000000000000000 --- 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 ddbfbc41ecaf3cfd18bdca3a60ac004eb5359069..83dbd9ac1bf7282687c0575710d36425891508e3 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 69c012e0d8e0e466ef43a53957f4c28d7ef2f596..2765182225f96183a03ad52d0c6a98f3ec9eaf1c 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 a00528616c3e5e3d0f4cdb5ac0edbf83a23bbcb9..44318b36f4b8a1c82b0137fc749f698e28ba9ead 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 0e8bb40e0ffee01357bae2610b948078587603a1..0000000000000000000000000000000000000000 --- 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 2c068052c541c0aa9a8055936d61a2fbccfa5e72..0000000000000000000000000000000000000000 --- 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 fc513b91f899aae03453c3fc8ddb42350a7ba3ac..b710578969b0d8bf6ed1f68585633c36c48174d4 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 623b8e6319f88e0e91a862a6baeac843b7c354f0..cf1fa2cfc4c2cbd8986f850bf48f8d06becf6086 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 e862b36dcd1680a2ddd7d8408fd921c13676a125..f93907f5e5cb00497d4a6c17d2b9850bb664e1df 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 2cb1f462e1daedb7613f7f5bfd64197b087299e3..1e5a5ecc08e0842946d8d255af1f5d6c6d51d768 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 557341fd4f09ecdbcefad4155b5de191fdfefce4..2c3d48e9bf735795db5ea8af67e8e67a7b72343f 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 0817d7c610ad1987297b88130ab615a16a82d8c7..53ebe1f9b5b64614e0c56ebdf5d6c1ee61099209 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 bd844cc58603eed2554c87bbbafe29f468deb764..73224c7b45cec051d46695e80625460d40e734be 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 7d6cdaef85b2f35ca70deec321b5876f7a862d5e..4c2805bf4bd0c4d6c594d09ac8cc45a570e5599f 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 54b1fdea7190d0dfd5bb773f1a729faaae622574..79f29c6b359d63629c9184805d7da9186c4695b4 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 c3fea8e86d4f469536cfcbd967488010d4e6422a..102cb636550dba42336e365e83559141ddaae89a 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 a2b8c54c3801d4e5ea618cfeaebfdd4fe8e100b0..0000000000000000000000000000000000000000 --- 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 02131734fb1af02ca30bb669744707d83c7a0332..8b9c790bbbf5875dc1012fa77763a91e29b55549 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 555306365713812285d5816d93ccb161987ff89e..2c78d14a86c755abc65261f7e3f036f3ef73a38e 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 1a07f614c14c7f19e9ba79e87df634ddf9de31e9..c459b9be3d09ca08660e2435b8ad5a449d2c77d7 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 d3a556e40099a90d41f7c3e511cf494ba7f5c631..a22b9fdea5c8f273a13ab140f174b37283c9e9bd 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 af1b38adf80d21ef4e3b41ce41efc7e988b6f0dd..11df00ee4fe2683f3f7bb8376c9dd6a14876499d 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 e5da4d2cdb16f0ffc48524947f66c462c1dd02b9..0000000000000000000000000000000000000000 --- 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 69f3938ecee3cb6eb5583d1e1220ed8b44075748..0000000000000000000000000000000000000000 --- 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 2690efb8f8588f6d2004e001175385dda4386791..0000000000000000000000000000000000000000 --- 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 76722b743d7313113353500aa82fb818e2ff1e50..412bdfaaf15aca8dd466929d5bcd150da51f25c6 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 a08cc6bdb6e2c16d33820932dbec67c877b756d6..89415df3588fa7878c14f4a5c322511ddbd8db19 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 c37f0ddbe99c2973330e883573173b367b650833..8ea407fc54470ab0b51a757c43b4d97be56997d2 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 3f6d5b8c18abe0bde53f242a778f4b58946d223f..01fc70c1d2cc1cf9d08540a0e52db0f0b8075c46 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 d8ba7e1b78868ec2d5253d1f9d589e82b915aef8..5e1b7bb69bb2bf29ec81d6f57fa0065f99f62b0e 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 87de4d3d3f296c89e1c65b9d3b69f66f8d3d5302..0000000000000000000000000000000000000000 --- 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 4947093d10cb8b38221eb0fb1031302ddc230496..0000000000000000000000000000000000000000 --- 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 7ed58be60720411f8867c93b6217a2ce1a2b100c..0000000000000000000000000000000000000000 --- 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 ede8331173237903c4c7272c1a2cfc2414003b80..0000000000000000000000000000000000000000 --- 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 07a8f5d4cfad6d25f2f258f160170015349b5f4f..0000000000000000000000000000000000000000 --- 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 9aa916a062e77e764596fc935e19484b8bbe0496..0000000000000000000000000000000000000000 --- 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 7135742db34b8f6fdea4e773c6c32a6a262e35bf..0000000000000000000000000000000000000000 --- 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 e7d1476c2b6d830017ae7d5f68a485f3acb2618a..0000000000000000000000000000000000000000 --- 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 7d93ae5615688beb7c614160d7e3247701229517..0000000000000000000000000000000000000000 --- 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 1e19522871af87cfce204e7f15d84f567e90cc8d..0000000000000000000000000000000000000000 --- 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 13ad5d2fae3dc627858849badaf0dbbe7003a689..0000000000000000000000000000000000000000 --- 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 7294b19ac9acc82911580bfe0410a91eb4a9a40a..0000000000000000000000000000000000000000 --- 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 411b9a56a2f27ff80060036953b7b3f629440b9e..0000000000000000000000000000000000000000 --- 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 1a2492e0ac8971aa59224dfb6f16b4a5d4f64ad8..0000000000000000000000000000000000000000 --- 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 e96bc14905e9d69377fa94c087c789c61fbb2ac8..0000000000000000000000000000000000000000 --- 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 a6564a68e19a51f82bb91badee38ebab56f957ed..0000000000000000000000000000000000000000 --- 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 23ec6cd0300a6b20ea172ed616bc3ba17a3a2834..0000000000000000000000000000000000000000 --- 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 692bf713b405e8768f30595f33392527003d398b..0000000000000000000000000000000000000000 --- 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 84b727ea20f9f1b22d4ff2f3a172cfcb3098819e..0000000000000000000000000000000000000000 --- 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 366531b9127bc5c495c67ce58aa043c1587ad1fe..0000000000000000000000000000000000000000 --- 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 725b57af7df5fab428f314c6dd6c3373b7ca41fb..0000000000000000000000000000000000000000 --- 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 627fb3d028ed9f4d33b427795d8eae9a64a7f8bb..0000000000000000000000000000000000000000 --- 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 66fd044d64e7e459ad8d0f51b8df1925b39b48a2..0000000000000000000000000000000000000000 --- 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 add7fe3f0f35961208f825f310b3720238eb805d..0000000000000000000000000000000000000000 --- 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 9ec7c4a1eb326c8575f7cce82e979cf3e236b60f..0000000000000000000000000000000000000000 --- 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 1e1caac0004e2541c11498134749b872455aee04..0000000000000000000000000000000000000000 --- 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 877e2beb703795c175e57eebc6183c6e9fa0f91f..0000000000000000000000000000000000000000 --- 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 01536233ffe5f90cac38b3d26e4ce5819ddb4191..0000000000000000000000000000000000000000 --- 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 54321e98e734361d0ff17738976d3617f3655140..0000000000000000000000000000000000000000 --- 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 7cc4fab999c2d6d4476a28ff63566c44f7d13beb..49a374f343c6fa27e2ad03b98c886d2463940bb6 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 2bad924192f78edaf27fa28e82e63c2b17cb347e..cc4dd13cf61c9c715fa3c75e4b9775313ee87f75 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 ac19c373bb201f0a64b56157c8ee43342893d143..7f44bcdb50c1a328e57751b55a85a3c3bea24cb8 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 2551dafe345ce74a0ab650562e3c680daf32f7f9..3997c5d3d29b82e7ef051f873c7ae6752494b781 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 7222d655a408f2b3d72bb4eaf8cf3f697ac9e4c3..8c4995e710097b24366935a4c40cebf718c771e4 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 525a93a4c83de0b86598e0214ed8ea21576c9d7e..0000000000000000000000000000000000000000 --- 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 344867568bb7a0e66fed569a4c9e9aafe455ca1e..0000000000000000000000000000000000000000 --- 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 163ccf5c029599437ce48efea80de3d7c01c3b51..0000000000000000000000000000000000000000 --- 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 8192566da19656c5c22f59232fc1bf646efbcc1a..129fa8bf7d926f7a6449021ed14d76a5463b5c2a 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 9e8e416d7b07d6707be65925defb78c8addad615..0000000000000000000000000000000000000000 --- 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 8d7bb55028f686d6b7039fc661adc4376283bbac..0000000000000000000000000000000000000000 --- 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 47c7e7f16f488cfeff4c0095b186ba4dcdb1d0a5..0000000000000000000000000000000000000000 --- 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 e62050c8ea962f7eb92ea68aa277db7ff60cdd6b..0000000000000000000000000000000000000000 --- 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 21d1d2359019a60839d9b444833bb7b343dd2620..0000000000000000000000000000000000000000 --- 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 bc8afff0cd626117a9bb3097a1d31da062263c6b..0000000000000000000000000000000000000000 --- 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 844b9392ec864095951e73c2a5c9e2a298cd2729..0000000000000000000000000000000000000000 --- 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 41ffdd7b4b9ad21eb00e87f1ca9636ccdb987de3..0000000000000000000000000000000000000000 --- 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 e319866d5ce73c7a3442c15501894ccf5f846390..262c19174b18b9edd5f33d16520e59f7e4ea12da 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 099431acd246c5af40f5c02f667c668b62845c21..a54a821a7b9b47bef62c3551c9b3580362a0d3a8 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 3eec506c9e3197f20cfbe66824e9889878913987..0000000000000000000000000000000000000000 --- 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 481a922a463f0abb9631e408f39fcf5599229527..0088a36eda9a3239019c73e0281eee4d8b1ad0d1 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 edcbd21476b42c2e4be56f1b619bc99c8f32f998..0000000000000000000000000000000000000000 --- 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 4ccf6744d5c003da09a54777dd96881a827f8886..d9b0940f80b3f328a745ba984ad29ee100ff94b6 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 12fc65cecb9434a6ddec35e11b426c999cd62443..117b133a11319fcc55c2dd02a8006e14c2eca9fa 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 0d5556a867b6d6e0860603380e30906585799387..0000000000000000000000000000000000000000 --- 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 8add96d8ed7bc87cad4787bd4e2123fde58eb0f3..c52549d286fd5bc44e6123a8910bc6ff27e5b7ad 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 433c3b54224735d4c59a758dbbc5c688d06ba5c5..3e22c8331839306de32446ae5827da8fb4910f27 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 7d8a3d3fb7965675b06bb00529643346b590e4bf..24fb503aea3a96ebf549fe9892d789aa0f1272a1 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 63e034c0eaa30798beb2ac506d4cdcbdc179faf1..0000000000000000000000000000000000000000 --- 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 424a09227ec0e23bfa1a51ca8f55c92b499e0760..94652e30fe64f2ac86fd1419607c1bc114b35610 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 9b3d2028edffb8d54f76f98d42a47fba7f2f1fc6..0000000000000000000000000000000000000000 --- 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 dfcef1712526a6b0b468a1dcdb93efd160896a63..0000000000000000000000000000000000000000 --- 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 547e7dfa9110ebc16f02622ee2d27d758dae195a..0000000000000000000000000000000000000000 --- 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 3d649b17b79372da5eaae8d50483d3b7c66c35e8..0000000000000000000000000000000000000000 --- 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 f0b9c85a53d33e713ca0bc8063370c085a2ab7df..0000000000000000000000000000000000000000 --- 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 9d4efea7e3d104c5b89981cdcc0049e64d98dd58..0000000000000000000000000000000000000000 --- 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 3def4571e134bda151f1078a3e517f82ab7346e3..0000000000000000000000000000000000000000 --- 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 931f500a3093556e876609ce6682b9489d456231..0000000000000000000000000000000000000000 --- 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 b8b8c9b89a8adf3c69e0655c7cf3890e19d18910..0000000000000000000000000000000000000000 --- 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 c2ba36006bd039db54da53a395695506a67a61ec..0000000000000000000000000000000000000000 --- 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 97fa53b5e243905a0d5360d24ae749e2e6201ce5..0000000000000000000000000000000000000000 --- 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 fd8179c59a59369ea32d34bca4701c7b0405bb25..0000000000000000000000000000000000000000 --- 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 cd0f3d6101a9c63d7dbf8979869b112ef041538f..e95c2034131552beed85a747b442bbac4233dfa2 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 835f1fe4d4a80dcf33711d25343ce66cf108b7fd..3faa30c4c8a20e896e0d17e594bdfdffedea91c0 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 430ee16bc8a26682078697fd3d7fc92d517851a6..0000000000000000000000000000000000000000 --- 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 325f6a2c8547301e0c1322ff60b6515c386a8fbe..0000000000000000000000000000000000000000 --- 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 d5047eb8f863b125559fcd5eb386fe675370e497..0000000000000000000000000000000000000000 --- 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 2cc3a89459eba2c4f5da39707ca091913764107b..0000000000000000000000000000000000000000 --- 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 2c1ae5d985489f5e9696ed367b34e6cbe62c3197..0000000000000000000000000000000000000000 --- 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 2164b00e0669131c0aa6bcfb2bb740c06c47df92..0000000000000000000000000000000000000000 --- 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 68e7b98183b3c3e7aa14e47e34c54f11f5239282..0000000000000000000000000000000000000000 --- 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 6d81cea8b2fcf82b1e70033d28db7e304a7dd010..d8777515cecf05e510ba1c89f8684d17d3c5b257 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 43cdf43ceb3548809e1b77e4437074e7e31ff8e4..52e512e515c589cd311ec59f29b0a0c72b0fc68b 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 78e17bb22bd0315c85abb1467a58adeb39efceb1..365070f704f8541efa68390296809412658b8741 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 d6920b2e2fe80e6beb06c607c4616e365d82a259..752e95f25dc5315d1fdc8664efbf2247c11a4c92 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 9aff6b917484e7b12c811f6d611d22fbf363b39d..dd9a7c97c9ab5f5ca8a2431955e28e321607be8d 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 777210d2b04525cc8facab9c12f7a47fc317a387..84f046499e439ca1f96c64e15c626a0a401760a2 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 e11cb28c65db8dbe93495a4ade6713b3af0427f2..3ac4b874f3ad8cb00dd48fb3e1622c0d13c10174 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 f7a91d11748b3bbdc5990366f3900a061ebf9258..0d1cf1c339227689787ff76a3712ea3719973ff3 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 3650c3f9246432f04336d9473764844d5c709d98..658183cf6ff5437b64fc1c74f1d58b55aa033b02 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 96e60dab3c9c672d2ccf6aaf92f989f45d4c4b7d..aa2ce824822b1d580e19a0e5d67a67a067549d7d 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 24ffd416499206b65cd9b311eeb822114387ec78..6b320e1474624a5e66b6dcde3ba202701cb01c7e 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 612e0a07dac129a810c707442b784c85ab960b17..4ebf981e4ee55aef4e4c1195c79b67b07204b5b9 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 b8a34b751814bd27aefd2c2a8cf7a1eadea52816..e59cf9f77fa6e9fc82f0555b2e6989fc5dbd2534 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 93f8ebf02acdb5db6800937b57b9cf0b2c93e660..4010c31eed50a3575394763b677d26458d6038fd 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 e124b2efe29f891ece25ba1b592a4de91a03bfbc..7eaaa5ea74eda657b05d3253ca4c7aa35aa5e3aa 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 f2dcaa4a31eaa2bdd29be934c815089ec780a394..3fff58410a41a86e8f9d307a2f6444d5b3a2b25c 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 1291f0b6cd1c78b71835f696835513dba505824c..0000000000000000000000000000000000000000 --- 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 abe6a2d9ee63f58693dc331981da74cbf75aac3f..919f0aae38e0acb48a104fe9520d154ff0a75470 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 1083f1b3c71cb6513f2c77e943f381734e67a203..0000000000000000000000000000000000000000 --- 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 57b9b2494f5ff044098cbef1dd17f15d6b37e1e6..0000000000000000000000000000000000000000 --- 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 3be122b38fa1ec5911e834df4d4aba028cc851d1..0000000000000000000000000000000000000000 --- 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 bbb3ce2f2e1a12dbf2ce7e4a833a6fbb29a36dd0..7d0778b685937f0cec8ba27a2bfe9b330de62b40 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 ee91ae124b876f0f5386e7ffdcd69e759ef0e1df..0000000000000000000000000000000000000000 --- 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 6f4ffa51a4677f6434d16e07cab2c19a6c5c84b0..0000000000000000000000000000000000000000 --- 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 bcc67738dd4e229359c60cd4b77ebab4a788202f..04540c2f35b29ef05fe73b00c59d5b973a38f4c1 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 21a7d57b5631eaf6fd7355ef2ac50097b1876c42..0000000000000000000000000000000000000000 --- 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 984cef559983da4a67056ce8ca84285203a6f71d..5e5d01ae6ee4529d209f1d1b4bb29e8aa470ce78 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 d00cdcca3e362feb7f070de076414419d9ac81a8..840a3c2a6ee86caf63b393390eec597a0f360e47 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 665303ac487655c73e9987c9079341a15d1ef3bf..0000000000000000000000000000000000000000 --- 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 18f332dbb97722d09439c4cacd361f6432e004b6..8444a632fe889c699f0cf932b524f83a1a56be3a 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 f61a8837e2c7c7dfe31eeb9fb92b6791d465cd73..991d0ecdc87a642356d4d3a1ce0e47940b4819b1 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 50971806a87460def2a2631cfd67dce11a55bb1b..8c35abad7f1e61e273b53a0595acb7a92e6ee06f 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 a7d52b87e551a11d03e4d38b959fae64fdf73a69..0c66b139e7c2ede137450ff632631007339c7e13 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 9dd65bdcb263ec7a1900daf0b0ab28cc2b296eac..5708310abadbfe88e0740d981feed67b5ff0edca 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 60c46d17b0699f1561495c72d39bbdcd4da54bc5..0000000000000000000000000000000000000000 --- 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 a6730d67ce0a45271dd5f3d74541dbe0176f3c08..8bdae89e523fd3e102c146a7cad8f712d5f488cf 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 34dccb8186586039b8e473f7bd2ea059aedf2bf0..8a10cc8c1ef4b4798d859e01c1e58f25cb279461 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 cfea444d7ffc7ee5100eb6afc29f5690d4748d0d..e6bfc8ec1a53de6be5f18f5fa4b7a8549b4e6622 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 f23166288fb55a687df0efe576df890395fda693..8967b07ca8823757b788c07edf1e52c79a515f88 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 88209192422508169b2fd7168d24978ff5ab69fd..0000000000000000000000000000000000000000 --- 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 b856386e1d353ba0e99ad721272598bef0f56dbe..8ad2dbc1acb75965906deb0bbbfa23ce45fa3677 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 15206f1c386d3762f532ef18c4c523478b58fcee..9a758c5d8ada48e9f2adfbe2d9f6dfb3007c1e39 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 09d9008c0b64a92235f8f2b3bf87be3b970032dd..5b0b7cc5b4ef1a3e9dc501b4aac8cfc3f6b76257 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 4d4417189c9081f805566c8235cf64e47bb07c13..1ecaf41702e0642a179c0dfc2885f92d2c22e3a9 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 4c021b18ad858dc4866f270bf14fc94778f41e31..d3dbca53f605f229c409ea528f788c3d26bed4c4 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 48022fefbbdba343dae18e0f66d86bb7f8fe4478..5ea22ae76c2c06b904dd0f395d7ef7e0682456e6 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 ba6a285d652f934d26ef257cdc0abd07c6a2269b..71bf6cc626153d38e962626512f59fd66a4c9c96 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 fd1efe1a20eeeab3e27d673bda5363c67d0d5842..8e798fc6a0d28738f2c0289786efaa780e59a0a5 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 b58db67c0acf1fbda587002d4e20d30715af55e1..2d6da26df52a32220c2f0be94bf2b15700cebaf0 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 fcce05a7b09cb835448f39632c7b2646449d2f7f..41a9e6e53f251772d893ab56406fd7c56c000730 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 30acf07ae60c7e2cd113d974ba58bf9f6bc1a77a..0000000000000000000000000000000000000000 --- 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 41a8ca33a2ab99e3e509bf7ee5df75715fcf3388..7265ddf661501934187c9d9749d2278fc7a16c37 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 0cd6210e13c795e65e7cf78ca0c8cb7e046b7b4c..6d8e7d1aaf3fdb66fde42ce974851073f0f0484d 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 0a77824cf47f7728981ee8cc04587587a1f889e9..cbb85b2b7b814500ca3cdfd4b09089f856c803ab 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 e342dcb365dfafbe74cdf63c6b4a11cd870937c4..0000000000000000000000000000000000000000 --- 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 c7aca64c7cb95205a66a3915ae980a01642399d9..0000000000000000000000000000000000000000 --- 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 478565c86fd4871ff8cf4efa0eec862917a1074c..493ec8ddc207d5b7a8763fc6a46fb4f64ad09fb4 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 70c8c5b64e40836e8e5e85a63225c9943ec02b23..0000000000000000000000000000000000000000 --- 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 6d04c0e26ad0ca752706a199b0b23458d3e2ccdc..0000000000000000000000000000000000000000 --- 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 6cc95a2e548b17b41c0dfb5dac4254a4a2592b0b..0000000000000000000000000000000000000000 --- 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 42132f0a12f4b6e0a92e5c230edafd960ac58bd0..498ec0e8fbaf1ae8974bea837a057c763bd8ae43 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 e8489e7c386cbef00d7bc2cc07886ec17dac1286..72204c28f82ade773eb42141ea6cc504ec2f3df1 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()));