diff --git a/src/libcollections/ringbuf.rs b/src/libcollections/ringbuf.rs index 29edf1db51d70..d7b092b9c1c7b 100644 --- a/src/libcollections/ringbuf.rs +++ b/src/libcollections/ringbuf.rs @@ -419,6 +419,7 @@ impl fmt::Show for RingBuf { mod tests { use std::fmt::Show; use std::prelude::*; + use std::gc::{GC, Gc}; use test::Bencher; use test; @@ -473,10 +474,10 @@ mod tests { #[test] fn test_boxes() { - let a: @int = @5; - let b: @int = @72; - let c: @int = @64; - let d: @int = @175; + 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); @@ -621,7 +622,8 @@ mod tests { #[test] fn test_param_at_int() { - test_parameterized::<@int>(@5, @72, @64, @175); + test_parameterized::>(box(GC) 5, box(GC) 72, + box(GC) 64, box(GC) 175); } #[test] diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index bb11ec5502e83..32c47d36bed99 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -2345,6 +2345,7 @@ mod tests { use num; use realstd::vec::Vec; use realstd::slice::Vector; + use realstd::gc::GC; use cmp; use realstd::owned::Box; @@ -2835,7 +2836,8 @@ mod tests { #[test] #[should_fail] fn test_rposition_fail() { - let v = [(box 0, @0), (box 0, @0), (box 0, @0), (box 0, @0)]; + let v = [(box 0, box(GC) 0), (box 0, box(GC) 0), + (box 0, box(GC) 0), (box 0, box(GC) 0)]; let mut i = 0; v.iter().rposition(|_elt| { if i == 2 { diff --git a/src/libdebug/reflect.rs b/src/libdebug/reflect.rs index 3a12aec39a187..cd94829f3540e 100644 --- a/src/libdebug/reflect.rs +++ b/src/libdebug/reflect.rs @@ -18,6 +18,7 @@ Runtime type reflection use std::intrinsics::{Disr, Opaque, TyDesc, TyVisitor}; use std::mem; +use std::gc::Gc; /** * Trait for visitor that wishes to reflect on data. @@ -219,9 +220,9 @@ impl TyVisitor for MovePtrAdaptor { } fn visit_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool { - self.align_to::<@u8>(); + self.align_to::>(); if ! self.inner.visit_box(mtbl, inner) { return false; } - self.bump_past::<@u8>(); + self.bump_past::>(); true } diff --git a/src/libdebug/repr.rs b/src/libdebug/repr.rs index 83eb4adfa9759..d6ae23c6d9acd 100644 --- a/src/libdebug/repr.rs +++ b/src/libdebug/repr.rs @@ -288,7 +288,7 @@ impl<'a> TyVisitor for ReprVisitor<'a> { _align: uint) -> bool { fail!(); } fn visit_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool { - try!(self, self.writer.write(['@' as u8])); + try!(self, self.writer.write("box(GC) ".as_bytes())); self.write_mut_qualifier(mtbl); self.get::<&raw::Box<()>>(|this, b| { let p = &b.data as *() as *u8; @@ -591,6 +591,7 @@ 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(); @@ -605,7 +606,7 @@ fn test_repr() { exact_test(&1.234, "1.234f64"); exact_test(&("hello"), "\"hello\""); - exact_test(&(@10), "@10"); + exact_test(&(box(GC) 10), "box(GC) 10"); exact_test(&(box 10), "box 10"); exact_test(&(&10), "&10"); let mut x = 10; @@ -619,8 +620,8 @@ fn test_repr() { "&[\"hi\", \"there\"]"); exact_test(&(P{a:10, b:1.234}), "repr::P{a: 10, b: 1.234f64}"); - 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/libfourcc/lib.rs b/src/libfourcc/lib.rs index 3949bde3d52f7..2d760bbad7728 100644 --- a/src/libfourcc/lib.rs +++ b/src/libfourcc/lib.rs @@ -63,6 +63,8 @@ use syntax::parse::token; use syntax::parse::token::InternedString; use rustc::plugin::Registry; +use std::gc::Gc; + #[plugin_registrar] pub fn plugin_registrar(reg: &mut Registry) { reg.register_macro("fourcc", expand_syntax_ext); @@ -130,7 +132,8 @@ struct Ident { span: Span } -fn parse_tts(cx: &ExtCtxt, tts: &[ast::TokenTree]) -> (@ast::Expr, Option) { +fn parse_tts(cx: &ExtCtxt, + tts: &[ast::TokenTree]) -> (Gc, Option) { let p = &mut parse::new_parser_from_tts(cx.parse_sess(), cx.cfg(), tts.iter() diff --git a/src/libhexfloat/lib.rs b/src/libhexfloat/lib.rs index b181b0ca8c977..5451e4fc18cfe 100644 --- a/src/libhexfloat/lib.rs +++ b/src/libhexfloat/lib.rs @@ -57,6 +57,8 @@ use syntax::parse; use syntax::parse::token; use rustc::plugin::Registry; +use std::gc::Gc; + #[plugin_registrar] pub fn plugin_registrar(reg: &mut Registry) { reg.register_macro("hexfloat", expand_syntax_ext); @@ -163,7 +165,8 @@ struct Ident { span: Span } -fn parse_tts(cx: &ExtCtxt, tts: &[ast::TokenTree]) -> (@ast::Expr, Option) { +fn parse_tts(cx: &ExtCtxt, + tts: &[ast::TokenTree]) -> (Gc, Option) { let p = &mut parse::new_parser_from_tts(cx.parse_sess(), cx.cfg(), tts.iter() diff --git a/src/libregex_macros/lib.rs b/src/libregex_macros/lib.rs index bbee09d0f38b3..8641936cc34ab 100644 --- a/src/libregex_macros/lib.rs +++ b/src/libregex_macros/lib.rs @@ -26,6 +26,7 @@ extern crate syntax; extern crate rustc; use std::rc::Rc; +use std::gc::{Gc, GC}; use syntax::ast; use syntax::codemap; @@ -110,7 +111,7 @@ struct NfaGen<'a> { } impl<'a> NfaGen<'a> { - fn code(&mut self) -> @ast::Expr { + fn code(&mut self) -> Gc { // Most or all of the following things are used in the quasiquoted // expression returned. let num_cap_locs = 2 * self.prog.num_captures(); @@ -331,7 +332,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str, // Generates code for the `add` method, which is responsible for adding // zero-width states to the next queue of states to visit. - fn add_insts(&self) -> @ast::Expr { + fn add_insts(&self) -> Gc { let arms = self.prog.insts.iter().enumerate().map(|(pc, inst)| { let nextpc = pc + 1; let body = match *inst { @@ -432,7 +433,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str, // Generates the code for the `step` method, which processes all states // in the current queue that consume a single character. - fn step_insts(&self) -> @ast::Expr { + fn step_insts(&self) -> Gc { let arms = self.prog.insts.iter().enumerate().map(|(pc, inst)| { let nextpc = pc + 1; let body = match *inst { @@ -523,7 +524,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str, // Translates a character class into a match expression. // This avoids a binary search (and is hopefully replaced by a jump // table). - fn match_class(&self, casei: bool, ranges: &[(char, char)]) -> @ast::Expr { + fn match_class(&self, casei: bool, ranges: &[(char, char)]) -> Gc { let expr_true = quote_expr!(self.cx, true); let mut arms = ranges.iter().map(|&(mut start, mut end)| { @@ -545,7 +546,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str, // Generates code for checking a literal prefix of the search string. // The code is only generated if the regex *has* a literal prefix. // Otherwise, a no-op is returned. - fn check_prefix(&self) -> @ast::Expr { + fn check_prefix(&self) -> Gc { if self.prog.prefix.len() == 0 { self.empty_block() } else { @@ -569,28 +570,28 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str, // A wild-card arm is automatically added that executes a no-op. It will // never be used, but is added to satisfy the compiler complaining about // non-exhaustive patterns. - fn match_insts(&self, mut arms: Vec) -> @ast::Expr { + fn match_insts(&self, mut arms: Vec) -> Gc { arms.push(self.wild_arm_expr(self.empty_block())); self.cx.expr_match(self.sp, quote_expr!(self.cx, pc), arms) } - fn empty_block(&self) -> @ast::Expr { + fn empty_block(&self) -> Gc { quote_expr!(self.cx, {}) } // Creates a match arm for the instruction at `pc` with the expression // `body`. - fn arm_inst(&self, pc: uint, body: @ast::Expr) -> ast::Arm { + fn arm_inst(&self, pc: uint, body: Gc) -> ast::Arm { let pc_pat = self.cx.pat_lit(self.sp, quote_expr!(self.cx, $pc)); self.cx.arm(self.sp, vec!(pc_pat), body) } // Creates a wild-card match arm with the expression `body`. - fn wild_arm_expr(&self, body: @ast::Expr) -> ast::Arm { + fn wild_arm_expr(&self, body: Gc) -> ast::Arm { ast::Arm { attrs: vec!(), - pats: vec!(@ast::Pat{ + pats: vec!(box(GC) ast::Pat{ id: ast::DUMMY_NODE_ID, span: self.sp, node: ast::PatWild, @@ -603,8 +604,9 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str, // Converts `xs` to a `[x1, x2, .., xN]` expression by calling `to_expr` // on each element in `xs`. - fn vec_expr>(&self, xs: It, to_expr: |&ExtCtxt, T| -> @ast::Expr) - -> @ast::Expr { + fn vec_expr>(&self, xs: It, + to_expr: |&ExtCtxt, T| -> Gc) + -> Gc { let exprs = xs.map(|x| to_expr(self.cx, x)).collect(); self.cx.expr_vec(self.sp, exprs) } diff --git a/src/librustc/front/config.rs b/src/librustc/front/config.rs index 58ac53002ba3c..2fa0ab9072c22 100644 --- a/src/librustc/front/config.rs +++ b/src/librustc/front/config.rs @@ -12,7 +12,7 @@ use syntax::fold::Folder; use syntax::{ast, fold, attr}; use syntax::codemap; -use std::gc::Gc; +use std::gc::{Gc, GC}; struct Context<'a> { in_cfg: |attrs: &[ast::Attribute]|: 'a -> bool, diff --git a/src/librustc/front/std_inject.rs b/src/librustc/front/std_inject.rs index dce14099bb365..bdb884cc82205 100644 --- a/src/librustc/front/std_inject.rs +++ b/src/librustc/front/std_inject.rs @@ -23,7 +23,7 @@ use syntax::parse::token; use syntax::util::small_vector::SmallVector; use std::mem; -use std::gc::Gc; +use std::gc::{Gc, GC}; pub static VERSION: &'static str = "0.11.0-pre"; diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs index 3a655a7e22c86..d33b76ae08c5e 100644 --- a/src/librustc/front/test.rs +++ b/src/librustc/front/test.rs @@ -18,7 +18,7 @@ use front::config; use front::std_inject::with_version; use std::cell::RefCell; -use std::gc::Gc; +use std::gc::{Gc, GC}; use std::slice; use std::vec; use syntax::ast_util::*; diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index 289c2feef2db1..c7524c11188bc 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -40,7 +40,7 @@ use libc; use std::io::Seek; use std::io::MemWriter; use std::mem; -use std::string::String; +use std::gc::GC; use serialize::ebml::reader; use serialize::ebml; diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs index 5335f9722a98b..44d722c209490 100644 --- a/src/librustc/middle/borrowck/mod.rs +++ b/src/librustc/middle/borrowck/mod.rs @@ -23,6 +23,7 @@ use util::ppaux::{note_and_explain_region, Repr, UserString}; use std::cell::{Cell}; use std::ops::{BitOr, BitAnd}; use std::rc::Rc; +use std::gc::{Gc, GC}; use std::string::String; use syntax::ast; use syntax::ast_map; @@ -70,7 +71,7 @@ pub fn check_crate(tcx: &ty::ctxt, krate: &ast::Crate) { let mut bccx = BorrowckCtxt { tcx: tcx, - stats: @BorrowStats { + stats: box(GC) BorrowStats { loaned_paths_same: Cell::new(0), loaned_paths_imm: Cell::new(0), stable_paths: Cell::new(0), @@ -155,7 +156,7 @@ pub struct BorrowckCtxt<'a> { tcx: &'a ty::ctxt, // Statistics: - stats: @BorrowStats + stats: Gc, } pub struct BorrowStats { diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index b937d8ef3bbc1..d8f7a97ce13ff 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -19,7 +19,7 @@ use middle::ty; use util::ppaux::ty_to_str; use std::cmp; -use std::gc::Gc; +use std::gc::{Gc, GC}; use std::iter; use syntax::ast::*; use syntax::ast_util::{is_unguarded, walk_pat}; diff --git a/src/librustc/middle/check_static.rs b/src/librustc/middle/check_static.rs index 36e98763ebbf8..33949ee5b1644 100644 --- a/src/librustc/middle/check_static.rs +++ b/src/librustc/middle/check_static.rs @@ -123,7 +123,7 @@ impl<'a> Visitor for CheckStaticVisitor<'a> { ast::ExprUnary(ast::UnUniq, _) | ast::ExprVstore(_, ast::ExprVstoreUniq) => { self.tcx.sess.span_err(e.span, - "static items are not allowed to have owned pointers"); + "static items are not allowed to have custom pointers"); } _ => { let node_ty = ty::node_id_to_type(self.tcx, e.id); diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs index 9979f13093535..1a3cb16675014 100644 --- a/src/librustc/middle/kind.rs +++ b/src/librustc/middle/kind.rs @@ -245,9 +245,12 @@ pub fn check_expr(cx: &mut Context, e: &Expr) { check_bounds_on_type_parameters(cx, e); match e.node { - ExprUnary(UnBox, ref interior) => { - let interior_type = ty::expr_ty(cx.tcx, &**interior); - let _ = check_static(cx.tcx, interior_type, interior.span); + ExprBox(ref loc, ref interior) => { + let def = ty::resolve_expr(cx.tcx, &**loc); + if Some(def.def_id()) == cx.tcx.lang_items.managed_heap() { + let interior_type = ty::expr_ty(cx.tcx, &**interior); + let _ = check_static(cx.tcx, interior_type, interior.span); + } } ExprCast(ref source, _) => { let source_ty = ty::expr_ty(cx.tcx, &**source); diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 47bc2521689ae..795c292b981f2 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -35,7 +35,7 @@ use syntax::visit::Visitor; use std::collections::{HashMap, HashSet}; use std::cell::{Cell, RefCell}; -use std::gc::Gc; +use std::gc::{Gc, GC}; use std::mem::replace; use std::rc::{Rc, Weak}; use std::uint; diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index 4c4b0a1290c47..9361d64250ca8 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -226,7 +226,7 @@ use util::ppaux::{Repr, vec_map_to_str}; use std::collections::HashMap; use std::cell::Cell; use std::rc::Rc; -use std::gc::Gc; +use std::gc::{Gc, GC}; use syntax::ast; use syntax::ast::Ident; use syntax::ast_util::path_to_ident; diff --git a/src/librustc/middle/typeck/infer/error_reporting.rs b/src/librustc/middle/typeck/infer/error_reporting.rs index 4d396ed4f6e5c..40d9543e669df 100644 --- a/src/librustc/middle/typeck/infer/error_reporting.rs +++ b/src/librustc/middle/typeck/infer/error_reporting.rs @@ -60,6 +60,7 @@ time of error detection. */ use std::collections::HashSet; +use std::gc::GC; use middle::def; use middle::subst; use middle::ty; diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 7e68be09f1d56..7ef1f52c949e5 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -32,7 +32,7 @@ use rustc::middle::ty; use std::rc::Rc; use std::u32; -use std::gc::Gc; +use std::gc::{Gc, GC}; use core; use doctree; diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index c206d203ee8ac..061798cb23e57 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -18,6 +18,7 @@ use syntax::parse::token; use syntax; use std::cell::RefCell; +use std::gc::GC; use std::os; use std::collections::{HashMap, HashSet}; diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 3b19dc3d0196b..411521fa0dbda 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -10,12 +10,13 @@ use std::cell::RefCell; use std::char; -use std::io; +use std::dynamic_lib::DynamicLibrary; +use std::gc::GC; use std::io::{Command, TempDir}; +use std::io; use std::os; use std::str; use std::string::String; -use std::dynamic_lib::DynamicLibrary; use std::collections::{HashSet, HashMap}; use testing; diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 555b396b44945..00fe0134f00ee 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -18,7 +18,7 @@ use syntax::ast_map; use syntax::attr::AttrMetaMethods; use syntax::codemap::Span; -use std::gc::Gc; +use std::gc::{Gc, GC}; use core; use doctree::*; diff --git a/src/librustrt/local_data.rs b/src/librustrt/local_data.rs index 1a7f0cdfc507e..215c0992bc022 100644 --- a/src/librustrt/local_data.rs +++ b/src/librustrt/local_data.rs @@ -274,6 +274,7 @@ impl Drop for Ref { #[cfg(test)] mod tests { use std::prelude::*; + use std::gc::{Gc, GC}; use super::*; use std::task; @@ -329,11 +330,11 @@ mod tests { #[test] fn test_tls_multiple_types() { static str_key: Key = &Key; - static box_key: Key<@()> = &Key; + static box_key: Key> = &Key; static int_key: Key = &Key; task::spawn(proc() { str_key.replace(Some("string data".to_string())); - box_key.replace(Some(@())); + box_key.replace(Some(box(GC) ())); int_key.replace(Some(42)); }); } @@ -341,13 +342,13 @@ mod tests { #[test] fn test_tls_overwrite_multiple_types() { static str_key: Key = &Key; - static box_key: Key<@()> = &Key; + static box_key: Key> = &Key; static int_key: Key = &Key; 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_key.replace(Some(@())); + box_key.replace(Some(box(GC) ())); + box_key.replace(Some(box(GC) ())); int_key.replace(Some(42)); // This could cause a segfault if overwriting-destruction is done // with the crazy polymorphic transmute rather than the provided @@ -360,13 +361,13 @@ mod tests { #[should_fail] fn test_tls_cleanup_on_failure() { static str_key: Key = &Key; - static box_key: Key<@()> = &Key; + static box_key: Key> = &Key; static int_key: Key = &Key; str_key.replace(Some("parent data".to_string())); - box_key.replace(Some(@())); + box_key.replace(Some(box(GC) ())); task::spawn(proc() { str_key.replace(Some("string data".to_string())); - box_key.replace(Some(@())); + box_key.replace(Some(box(GC) ())); int_key.replace(Some(42)); fail!(); }); diff --git a/src/librustrt/local_heap.rs b/src/librustrt/local_heap.rs index 52fe5c35a268f..d09033e771cf7 100644 --- a/src/librustrt/local_heap.rs +++ b/src/librustrt/local_heap.rs @@ -317,14 +317,15 @@ pub unsafe fn local_free(ptr: *u8) { mod bench { extern crate test; use self::test::Bencher; + use std::gc::GC; #[bench] fn alloc_managed_small(b: &mut Bencher) { - b.iter(|| { @10; }); + b.iter(|| { box(GC) 10 }); } #[bench] fn alloc_managed_big(b: &mut Bencher) { - b.iter(|| { @([10, ..1000]); }); + b.iter(|| { box(GC) ([10, ..1000]) }); } } diff --git a/src/librustrt/task.rs b/src/librustrt/task.rs index bde14b962c7a4..e99703a1f58bc 100644 --- a/src/librustrt/task.rs +++ b/src/librustrt/task.rs @@ -397,10 +397,11 @@ mod test { use super::*; use std::prelude::*; use std::task; + use std::gc::{Gc, GC}; #[test] fn local_heap() { - let a = @5; + let a = box(GC) 5; let b = a; assert!(*a == 5); assert!(*b == 5); @@ -408,11 +409,11 @@ mod test { #[test] fn tls() { - local_data_key!(key: @String) - key.replace(Some(@"data".to_string())); + local_data_key!(key: Gc) + key.replace(Some(box(GC) "data".to_string())); assert_eq!(key.get().unwrap().as_slice(), "data"); - local_data_key!(key2: @String) - key2.replace(Some(@"data".to_string())); + local_data_key!(key2: Gc) + key2.replace(Some(box(GC) "data".to_string())); assert_eq!(key2.get().unwrap().as_slice(), "data"); } @@ -452,11 +453,11 @@ mod test { use std::cell::RefCell; struct List { - next: Option<@RefCell>, + next: Option>>, } - let a = @RefCell::new(List { next: None }); - let b = @RefCell::new(List { next: Some(a) }); + 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(); diff --git a/src/libserialize/serialize.rs b/src/libserialize/serialize.rs index 40092a477b396..0ed555e392fa1 100644 --- a/src/libserialize/serialize.rs +++ b/src/libserialize/serialize.rs @@ -16,7 +16,7 @@ Core encoding and decoding interfaces. use std::path; use std::rc::Rc; -use std::gc::Gc; +use std::gc::{Gc, GC}; pub trait Encoder { // Primitive types: diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs index 6fb08b6ef7556..dfe6988624eb0 100644 --- a/src/libstd/prelude.rs +++ b/src/libstd/prelude.rs @@ -92,7 +92,3 @@ #[doc(no_inline)] pub use comm::{sync_channel, channel}; #[doc(no_inline)] pub use comm::{SyncSender, Sender, Receiver}; #[doc(no_inline)] pub use task::spawn; - -// Reexported statics -#[cfg(not(test))] -#[doc(no_inline)] pub use gc::GC; diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index b8e08dab722ea..08f412cd76381 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -21,7 +21,7 @@ use std::fmt; use std::fmt::Show; use std::option::Option; use std::rc::Rc; -use std::gc::Gc; +use std::gc::{Gc, GC}; use serialize::{Encodable, Decodable, Encoder, Decoder}; /// A pointer abstraction. FIXME(eddyb) #10676 use Rc in the future. diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index d78c9c2edc34a..828e9ab12c251 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -20,7 +20,7 @@ use util::small_vector::SmallVector; use std::cell::RefCell; use std::fmt; -use std::gc::Gc; +use std::gc::{Gc, GC}; use std::iter; use std::slice; diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 8e0a2218ea369..372f69b805a2a 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -21,7 +21,7 @@ use visit; use std::cell::Cell; use std::cmp; -use std::gc::Gc; +use std::gc::{Gc, GC}; use std::u32; pub fn path_name_i(idents: &[Ident]) -> String { diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 83f1326c65621..31dd07f463c63 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -22,7 +22,7 @@ use crateid::CrateId; use std::collections::HashSet; use std::collections::BitvSet; -use std::gc::Gc; +use std::gc::{Gc, GC}; local_data_key!(used_attrs: BitvSet) diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs index a982e4c103458..7aa93dee11df9 100644 --- a/src/libsyntax/ext/asm.rs +++ b/src/libsyntax/ext/asm.rs @@ -20,6 +20,8 @@ use parse; use parse::token::InternedString; use parse::token; +use std::gc::GC; + enum State { Asm, Outputs, diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 7ba517a3aedbd..421f8b1294d6a 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -20,7 +20,7 @@ use parse::token::{InternedString, intern, str_to_ident}; use util::small_vector::SmallVector; use std::collections::HashMap; -use std::gc::Gc; +use std::gc::{Gc, GC}; // new-style macro! tt code: // diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 4ef7796c454b6..b99ab50c32618 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -21,7 +21,7 @@ use parse::token::special_idents; use parse::token::InternedString; use parse::token; -use std::gc::Gc; +use std::gc::{Gc, GC}; // Transitional reexports so qquote can find the paths it is looking for mod syntax { diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs index 3522095ed7004..7cf901bbd5e1c 100644 --- a/src/libsyntax/ext/concat_idents.rs +++ b/src/libsyntax/ext/concat_idents.rs @@ -16,7 +16,7 @@ use owned_slice::OwnedSlice; use parse::token; use parse::token::{str_to_ident}; -use std::string::String; +use std::gc::GC; pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> Box { diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs index 251eae75ee551..05269dbb44dda 100644 --- a/src/libsyntax/ext/deriving/generic/mod.rs +++ b/src/libsyntax/ext/deriving/generic/mod.rs @@ -178,7 +178,7 @@ StaticEnum(, ~[(, , Unnamed(~[, fld: &mut MacroExpander) -> Gc { match e.node { @@ -1030,6 +1030,8 @@ mod test { use visit; use visit::Visitor; + use std::gc::GC; + // a visitor that extracts the paths // from a given thingy and puts them in a mutable // array (passed in to the traversal) diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index ca7596925a9cb..33ea186db35c4 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -20,7 +20,7 @@ use rsparse = parse; use parse = fmt_macros; use std::collections::HashMap; -use std::gc::Gc; +use std::gc::{Gc, GC}; #[deriving(PartialEq)] enum ArgumentType { diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 85035a8d38e43..86fbc8cec2a34 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -22,6 +22,7 @@ use parse::token::{Token, EOF, Nonterminal}; use parse::token; use std::rc::Rc; +use std::gc::GC; use std::collections::HashMap; /* This is an Earley-like parser, without support for in-grammar nonterminals, diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index d61a79e4e80be..2e538c9579b7e 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -17,7 +17,7 @@ use owned_slice::OwnedSlice; use util::small_vector::SmallVector; use std::rc::Rc; -use std::gc::Gc; +use std::gc::{Gc, GC}; // We may eventually want to be able to fold over type parameters, too. pub trait Folder { diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index c9122e3ceafb5..f48ddf4417bf6 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -16,7 +16,7 @@ use parse::token; use parse::parser::Parser; use parse::token::INTERPOLATED; -use std::gc::Gc; +use std::gc::{Gc, GC}; // a parser that can parse attributes. pub trait ParserAttr { diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 1ebcbc8a7d102..faffc49684603 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -282,6 +282,7 @@ mod test { use std::io; use std::io::MemWriter; use std::str; + use std::gc::GC; use codemap::{Span, BytePos, Spanned}; use owned_slice::OwnedSlice; use ast; diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index e280c24492983..025684ae71e8c 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -22,7 +22,7 @@ use codemap::{Span, respan}; use parse::parser; use parse::token; -use std::gc::Gc; +use std::gc::{Gc, GC}; /// The specific types of unsupported syntax #[deriving(PartialEq, Eq, Hash)] @@ -31,6 +31,8 @@ pub enum ObsoleteSyntax { ObsoleteOwnedExpr, ObsoleteOwnedPattern, ObsoleteOwnedVector, + ObsoleteManagedType, + ObsoleteManagedExpr, } pub trait ParserObsoleteMethods { @@ -68,6 +70,14 @@ impl<'a> ParserObsoleteMethods for parser::Parser<'a> { "`~[T]` is no longer a type", "use the `Vec` type instead" ), + ObsoleteManagedType => ( + "`@` notation for managed pointers", + "use `Gc` in `std::gc` instead" + ), + ObsoleteManagedExpr => ( + "`@` notation for a managed pointer allocation", + "use the `box(GC)` oeprator instead of `@`" + ), }; self.report(sp, kind, kind_str, desc); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 250ed4af57198..ae3b8587ee510 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -79,7 +79,7 @@ use owned_slice::OwnedSlice; use std::collections::HashSet; use std::mem::replace; use std::rc::Rc; -use std::gc::Gc; +use std::gc::{Gc, GC}; #[allow(non_camel_case_types)] #[deriving(PartialEq)] @@ -1342,6 +1342,8 @@ impl<'a> Parser<'a> { } else if self.token == token::AT { // MANAGED POINTER self.bump(); + let span = self.last_span; + self.obsolete(span, ObsoleteManagedType); TyBox(self.parse_ty(plus_allowed)) } else if self.token == token::TILDE { // OWNED POINTER @@ -2375,9 +2377,10 @@ impl<'a> Parser<'a> { } token::AT => { self.bump(); + let span = self.last_span; + self.obsolete(span, ObsoleteManagedExpr); let e = self.parse_prefix_expr(); hi = e.span.hi; - // HACK: pretending @[] is a (removed) @-vec ex = self.mk_unary(UnBox, e); } token::TILDE => { diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs index 1417cb5e8576f..04116dec60e31 100644 --- a/src/libsyntax/util/parser_testing.rs +++ b/src/libsyntax/util/parser_testing.rs @@ -15,6 +15,8 @@ use parse::{new_parser_from_source_str}; use parse::parser::Parser; use parse::token; +use std::gc::Gc; + // map a string to tts, using a made-up filename: pub fn string_to_tts(source_str: String) -> Vec { let ps = new_parse_sess(); @@ -46,21 +48,21 @@ pub fn string_to_crate (source_str : String) -> ast::Crate { } // parse a string, return an expr -pub fn string_to_expr (source_str : String) -> @ast::Expr { +pub fn string_to_expr (source_str : String) -> Gc { with_error_checking_parse(source_str, |p| { p.parse_expr() }) } // parse a string, return an item -pub fn string_to_item (source_str : String) -> Option<@ast::Item> { +pub fn string_to_item (source_str : String) -> Option> { with_error_checking_parse(source_str, |p| { p.parse_item(Vec::new()) }) } // parse a string, return a stmt -pub fn string_to_stmt(source_str : String) -> @ast::Stmt { +pub fn string_to_stmt(source_str : String) -> Gc { with_error_checking_parse(source_str, |p| { p.parse_stmt(Vec::new()) }) @@ -68,7 +70,7 @@ pub fn string_to_stmt(source_str : String) -> @ast::Stmt { // parse a string, return a pat. Uses "irrefutable"... which doesn't // (currently) affect parsing. -pub fn string_to_pat(source_str: String) -> @ast::Pat { +pub fn string_to_pat(source_str: String) -> Gc { string_to_parser(&new_parse_sess(), source_str).parse_pat() } diff --git a/src/test/auxiliary/cci_nested_lib.rs b/src/test/auxiliary/cci_nested_lib.rs index e66e89f34808c..58c58ef3aeb96 100644 --- a/src/test/auxiliary/cci_nested_lib.rs +++ b/src/test/auxiliary/cci_nested_lib.rs @@ -11,6 +11,7 @@ #![feature(managed_boxes)] use std::cell::RefCell; +use std::gc::{Gc, GC}; pub struct Entry { key: A, @@ -19,7 +20,7 @@ pub struct Entry { pub struct alist { eq_fn: extern "Rust" fn(A,A) -> bool, - data: @RefCell> >, + data: Gc>>>, } pub fn alist_add(lst: &alist, k: A, v: B) { @@ -47,7 +48,7 @@ pub fn new_int_alist() -> alist { fn eq_int(a: int, b: int) -> bool { a == b } return alist { eq_fn: eq_int, - data: @RefCell::new(Vec::new()), + data: box(GC) RefCell::new(Vec::new()), }; } @@ -57,6 +58,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: @RefCell::new(Vec::new()), + data: box(GC) 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 2057a629bb1af..2aa503afb8d23 100644 --- a/src/test/auxiliary/crate-method-reexport-grrrrrrr2.rs +++ b/src/test/auxiliary/crate-method-reexport-grrrrrrr2.rs @@ -28,8 +28,9 @@ pub mod name_pool { pub mod rust { pub use name_pool::add; + use std::gc::Gc; - pub type rt = @(); + pub type rt = Gc<()>; 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 ad1b58f34477a..6280d776e36f0 100644 --- a/src/test/auxiliary/issue-2631-a.rs +++ b/src/test/auxiliary/issue-2631-a.rs @@ -14,8 +14,9 @@ use std::cell::RefCell; use std::collections::HashMap; +use std::gc::Gc; -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 5e10ff516ccb6..6ce5bff60e6e0 100644 --- a/src/test/auxiliary/issue-5521.rs +++ b/src/test/auxiliary/issue-5521.rs @@ -11,5 +11,7 @@ #![feature(managed_boxes)] use std::collections::HashMap; +use std::gc::Gc; + +pub type map = Gc>; -pub type map = @HashMap; diff --git a/src/test/auxiliary/macro_crate_test.rs b/src/test/auxiliary/macro_crate_test.rs index 805b8a894cb7e..e17e21ae7f41b 100644 --- a/src/test/auxiliary/macro_crate_test.rs +++ b/src/test/auxiliary/macro_crate_test.rs @@ -21,6 +21,8 @@ use syntax::ext::base::*; use syntax::parse::token; use rustc::plugin::Registry; +use std::gc::{Gc, GC}; + #[macro_export] macro_rules! exported_macro (() => (2)) @@ -42,9 +44,9 @@ fn expand_make_a_1(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) MacExpr::new(quote_expr!(cx, 1i)) } -fn expand_into_foo(cx: &mut ExtCtxt, sp: Span, attr: @MetaItem, it: @Item) - -> @Item { - @Item { +fn expand_into_foo(cx: &mut ExtCtxt, sp: Span, attr: Gc, it: Gc) + -> Gc { + box(GC) Item { attrs: it.attrs.clone(), ..(*quote_item!(cx, enum Foo { Bar, Baz }).unwrap()).clone() } diff --git a/src/test/bench/task-perf-alloc-unwind.rs b/src/test/bench/task-perf-alloc-unwind.rs index 7baa500ee0d38..037a326880f00 100644 --- a/src/test/bench/task-perf-alloc-unwind.rs +++ b/src/test/bench/task-perf-alloc-unwind.rs @@ -17,7 +17,7 @@ use time::precise_time_s; use std::os; use std::task; use std::vec; -use std::gc::Gc; +use std::gc::{Gc, GC}; #[deriving(Clone)] enum List { @@ -53,10 +53,10 @@ type nillist = List<()>; // Filled with things that have to be unwound struct State { - managed: @nillist, + managed: Gc, unique: Box, - tuple: (@nillist, Box), - vec: Vec<@nillist>, + tuple: (Gc, Box), + vec: Vec>, res: r } diff --git a/src/test/compile-fail/autoderef-full-lval.rs b/src/test/compile-fail/autoderef-full-lval.rs index 3bb66e3b099f7..f4b410d30319d 100644 --- a/src/test/compile-fail/autoderef-full-lval.rs +++ b/src/test/compile-fail/autoderef-full-lval.rs @@ -12,23 +12,25 @@ extern crate debug; +use std::gc::{Gc, GC}; + struct clam { - x: @int, - y: @int, + x: Gc, + y: Gc, } struct fish { - a: @int, + a: Gc, } fn main() { - let a: clam = clam{x: @1, y: @2}; - let b: clam = clam{x: @10, y: @20}; + 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 `@int` println!("{:?}", z); assert_eq!(z, 21); - let forty: fish = fish{a: @40}; - let two: fish = fish{a: @2}; + let forty: fish = fish{a: box(GC) 40}; + let two: fish = fish{a: box(GC) 2}; let answer: int = forty.a + two.a; //~^ ERROR binary operation `+` cannot be applied to type `@int` println!("{:?}", answer); diff --git a/src/test/compile-fail/borrowck-managed-pointer-deref-scope.rs b/src/test/compile-fail/borrowck-managed-pointer-deref-scope.rs index 4695360a688de..dba2c7dca766a 100644 --- a/src/test/compile-fail/borrowck-managed-pointer-deref-scope.rs +++ b/src/test/compile-fail/borrowck-managed-pointer-deref-scope.rs @@ -13,7 +13,9 @@ #![feature(managed_boxes)] -fn foo<'a>(x: &'a @int) -> &'a int { +use std::gc::{GC, Gc}; + +fn foo<'a>(x: &'a Gc) -> &'a int { match x { &ref y => { &**y // Do not expect an error here @@ -25,7 +27,7 @@ fn bar() { let a = 3; let mut y = &a; if true { - let x = @3; + let x = box(GC) 3; y = &*x; //~ ERROR `*x` does not live long enough } } diff --git a/src/test/compile-fail/borrowck-preserve-box-in-field.rs b/src/test/compile-fail/borrowck-preserve-box-in-field.rs index 68410ae4fe196..416c272b8ce1b 100644 --- a/src/test/compile-fail/borrowck-preserve-box-in-field.rs +++ b/src/test/compile-fail/borrowck-preserve-box-in-field.rs @@ -12,6 +12,7 @@ #![feature(managed_boxes)] +use std::gc::GC; fn borrow(x: &int, f: |x: &int|) { let before = *x; @@ -23,13 +24,13 @@ fn borrow(x: &int, f: |x: &int|) { struct F { f: Box } pub fn main() { - let mut x = @F {f: box 3}; + 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 *int, &(*b_x) as *int); //~^ NOTE borrow occurs due to use of `x` in closure - x = @F {f: box 4}; + x = box(GC) F {f: box 4}; println!("&*b_x = {:p}", &(*b_x)); assert_eq!(*b_x, 3); diff --git a/src/test/compile-fail/borrowck-preserve-box-in-uniq.rs b/src/test/compile-fail/borrowck-preserve-box-in-uniq.rs index 0db097ec003c2..dcfead3a1c205 100644 --- a/src/test/compile-fail/borrowck-preserve-box-in-uniq.rs +++ b/src/test/compile-fail/borrowck-preserve-box-in-uniq.rs @@ -12,6 +12,7 @@ #![feature(managed_boxes)] +use std::gc::GC; fn borrow(x: &int, f: |x: &int|) { let before = *x; @@ -23,13 +24,13 @@ fn borrow(x: &int, f: |x: &int|) { struct F { f: Box } pub fn main() { - let mut x = box @F{f: box 3}; + 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 *int, &(*b_x) as *int); //~^ NOTE borrow occurs due to use of `x` in closure - *x = @F{f: box 4}; + *x = box(GC) F{f: box 4}; println!("&*b_x = {:p}", &(*b_x)); assert_eq!(*b_x, 3); diff --git a/src/test/compile-fail/borrowck-preserve-box.rs b/src/test/compile-fail/borrowck-preserve-box.rs index cd36d93060462..ccf0fb3711a91 100644 --- a/src/test/compile-fail/borrowck-preserve-box.rs +++ b/src/test/compile-fail/borrowck-preserve-box.rs @@ -12,6 +12,8 @@ #![feature(managed_boxes)] +use std::gc::GC; + fn borrow(x: &int, f: |x: &int|) { let before = *x; f(x); @@ -20,13 +22,13 @@ fn borrow(x: &int, f: |x: &int|) { } pub fn main() { - let mut x = @3; + 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 *int, &(*b_x) as *int); //~^ NOTE borrow occurs due to use of `x` in closure - x = @22; + x = box(GC) 22; println!("&*b_x = {:p}", &(*b_x)); assert_eq!(*b_x, 3); diff --git a/src/test/compile-fail/borrowck-preserve-cond-box.rs b/src/test/compile-fail/borrowck-preserve-cond-box.rs index 7000e2351dd91..e1641f54a6c2a 100644 --- a/src/test/compile-fail/borrowck-preserve-cond-box.rs +++ b/src/test/compile-fail/borrowck-preserve-cond-box.rs @@ -12,9 +12,11 @@ #![feature(managed_boxes)] +use std::gc::GC; + fn testfn(cond: bool) { - let mut x = @3; - let mut y = @4; + let mut x = box(GC) 3; + let mut y = box(GC) 4; // borrow x and y let r_x = &*x; @@ -30,13 +32,13 @@ fn testfn(cond: bool) { println!("*r = {}, exp = {}", *r, exp); assert_eq!(*r, exp); - x = @5; //~ERROR cannot assign to `x` because it is borrowed - y = @6; //~ERROR cannot assign to `y` because it is borrowed + x = box(GC) 5; //~ERROR cannot assign to `x` because it is borrowed + y = box(GC) 6; //~ERROR cannot assign to `y` because it is borrowed println!("*r = {}, exp = {}", *r, exp); assert_eq!(*r, exp); - assert_eq!(x, @5); - assert_eq!(y, @6); + assert_eq!(x, box(GC) 5); + assert_eq!(y, box(GC) 6); } pub fn main() { diff --git a/src/test/compile-fail/borrowck-preserve-expl-deref.rs b/src/test/compile-fail/borrowck-preserve-expl-deref.rs index ca24192e797e2..4a7a7b0f26595 100644 --- a/src/test/compile-fail/borrowck-preserve-expl-deref.rs +++ b/src/test/compile-fail/borrowck-preserve-expl-deref.rs @@ -12,6 +12,7 @@ #![feature(managed_boxes)] +use std::gc::GC; fn borrow(x: &int, f: |x: &int|) { let before = *x; @@ -23,13 +24,13 @@ fn borrow(x: &int, f: |x: &int|) { struct F { f: Box } pub fn main() { - let mut x = @F {f: box 3}; + 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 *int, &(*b_x) as *int); //~^ NOTE borrow occurs due to use of `x` in closure - x = @F {f: box 4}; + x = box(GC) F {f: box 4}; println!("&*b_x = {:p}", &(*b_x)); assert_eq!(*b_x, 3); diff --git a/src/test/compile-fail/box-static-bound.rs b/src/test/compile-fail/box-static-bound.rs index c4064c6fcace6..e2622b6e72d68 100644 --- a/src/test/compile-fail/box-static-bound.rs +++ b/src/test/compile-fail/box-static-bound.rs @@ -10,12 +10,14 @@ #![feature(managed_boxes)] -fn f(x: T) -> @T { - @x //~ ERROR value may contain references +use std::gc::{Gc, GC}; + +fn f(x: T) -> Gc { + box(GC) x //~ ERROR value may contain references } -fn g(x: T) -> @T { - @x // ok +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 9c6967b461a0d..da5f7680d8ce7 100644 --- a/src/test/compile-fail/check-static-values-constraints.rs +++ b/src/test/compile-fail/check-static-values-constraints.rs @@ -12,6 +12,7 @@ // Verifies all possible restrictions for static items values. use std::kinds::marker; +use std::gc::{Gc, GC}; struct WithDtor; @@ -95,7 +96,7 @@ static STATIC10: UnsafeStruct = UnsafeStruct; struct MyOwned; static STATIC11: Box = box MyOwned; -//~^ ERROR static items are not allowed to have owned pointers +//~^ ERROR static items are not allowed to have custom pointers // The following examples test that mutable structs are just forbidden // to have types with destructors @@ -113,24 +114,24 @@ static mut STATIC14: SafeStruct = SafeStruct { }; static STATIC15: &'static [Box] = &'static [box MyOwned, box MyOwned]; -//~^ ERROR static items are not allowed to have owned pointers -//~^^ ERROR static items are not allowed to have owned pointers +//~^ ERROR static items are not allowed to have custom pointers +//~^^ ERROR static items are not allowed to have custom pointers static STATIC16: (&'static Box, &'static Box) = (&'static box MyOwned, &'static box MyOwned); -//~^ ERROR static items are not allowed to have owned pointers -//~^^ ERROR static items are not allowed to have owned pointers +//~^ ERROR static items are not allowed to have custom pointers +//~^^ ERROR static items are not allowed to have custom pointers static mut STATIC17: SafeEnum = Variant1; //~^ ERROR mutable static items are not allowed to have destructors -static STATIC18: @SafeStruct = @SafeStruct{field1: Variant1, field2: Variant2(0)}; -//~^ ERROR static items are not allowed to have managed pointers +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 owned pointers +//~^ ERROR static items are not allowed to have custom pointers pub fn main() { let y = { static x: Box = box 3; x }; - //~^ ERROR static items are not allowed to have owned pointers + //~^ 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 2344bd0f090fd..06079a5487ff4 100644 --- a/src/test/compile-fail/core-tls-store-pointer.rs +++ b/src/test/compile-fail/core-tls-store-pointer.rs @@ -10,7 +10,9 @@ // Testing that we can't store a reference it task-local storage -local_data_key!(key: @&int) +use std::gc::{GC, Gc}; + +local_data_key!(key: Gc<&int>) //~^ ERROR missing lifetime specifier fn main() {} diff --git a/src/test/compile-fail/issue-2063-resource.rs b/src/test/compile-fail/issue-2063-resource.rs index d34fb10e9dd58..9e365acc5abeb 100644 --- a/src/test/compile-fail/issue-2063-resource.rs +++ b/src/test/compile-fail/issue-2063-resource.rs @@ -10,6 +10,8 @@ #![feature(managed_boxes)] +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. @@ -18,7 +20,7 @@ struct t { //~ ERROR this type cannot be instantiated to_str: (), } -struct x(@t); //~ ERROR this type cannot be instantiated +struct x(Gc); //~ ERROR this type cannot be instantiated fn main() { } diff --git a/src/test/compile-fail/issue-3668.rs b/src/test/compile-fail/issue-3668.rs index e3b145411baa6..ec3808fa2c75d 100644 --- a/src/test/compile-fail/issue-3668.rs +++ b/src/test/compile-fail/issue-3668.rs @@ -10,14 +10,16 @@ #![feature(managed_boxes)] -struct P { child: Option<@P> } +use std::gc::Gc; + +struct P { child: Option> } trait PTrait { - fn getChildOption(&self) -> Option<@P>; + fn getChildOption(&self) -> Option>; } impl PTrait for P { - fn getChildOption(&self) -> Option<@P> { - static childVal: @P = self.child.get(); + fn getChildOption(&self) -> Option> { + static childVal: Gc

= 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 657d9c8f17ea5..30b05c7bbaac7 100644 --- a/src/test/compile-fail/issue-3763.rs +++ b/src/test/compile-fail/issue-3763.rs @@ -10,6 +10,8 @@ #![feature(managed_boxes)] +use std::gc::GC; + mod my_mod { pub struct MyStruct { priv_field: int @@ -28,11 +30,11 @@ 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 = (@my_struct).priv_field; + 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 - (@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 d62c27edf51da..b05bff208258e 100644 --- a/src/test/compile-fail/issue-7061.rs +++ b/src/test/compile-fail/issue-7061.rs @@ -10,10 +10,12 @@ #![feature(managed_boxes)] +use std::gc::Gc; + struct BarStruct; impl<'a> BarStruct { - fn foo(&'a mut self) -> @BarStruct { self } + fn foo(&'a mut self) -> Gc { self } //~^ ERROR: error: mismatched types: expected `@BarStruct` but found `&'a mut BarStruct } diff --git a/src/test/compile-fail/issue-7364.rs b/src/test/compile-fail/issue-7364.rs index ca66905688ad9..96d25737f7e1a 100644 --- a/src/test/compile-fail/issue-7364.rs +++ b/src/test/compile-fail/issue-7364.rs @@ -11,9 +11,10 @@ #![feature(managed_boxes)] use std::cell::RefCell; +use std::gc::{Gc, GC}; // Regresion test for issue 7364 -static managed: @RefCell = @RefCell::new(0); -//~^ ERROR static items are not allowed to have managed pointers +static managed: Gc> = box(GC) 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 651ea6abf08cc..06232580198f0 100644 --- a/src/test/compile-fail/kindck-copy.rs +++ b/src/test/compile-fail/kindck-copy.rs @@ -13,6 +13,7 @@ #![feature(managed_boxes)] use std::rc::Rc; +use std::gc::Gc; fn assert_copy() { } trait Dummy { } @@ -77,7 +78,7 @@ fn test<'a,T,U:Copy>(_: &'a int) { assert_copy::(); //~ ERROR does not fulfill // managed or ref counted types are not ok - assert_copy::<@int>(); //~ ERROR does not fulfill + assert_copy::>(); //~ ERROR does not fulfill assert_copy::>(); //~ ERROR does not fulfill } diff --git a/src/test/compile-fail/kindck-destructor-owned.rs b/src/test/compile-fail/kindck-destructor-owned.rs index 0e1190d2c124e..fa5f15316378d 100644 --- a/src/test/compile-fail/kindck-destructor-owned.rs +++ b/src/test/compile-fail/kindck-destructor-owned.rs @@ -10,8 +10,10 @@ #![feature(managed_boxes)] +use std::gc::Gc; + struct Foo { - f: @int, + f: Gc, } 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 8fe9694b0cb46..cad340cedb17b 100644 --- a/src/test/compile-fail/kindck-nonsendable-1.rs +++ b/src/test/compile-fail/kindck-nonsendable-1.rs @@ -10,10 +10,12 @@ #![feature(managed_boxes)] -fn foo(_x: @uint) {} +use std::gc::{Gc, GC}; + +fn foo(_x: Gc) {} fn main() { - let x = @3u; + let x = box(GC) 3u; let _: proc():Send = proc() foo(x); //~ ERROR does not fulfill `Send` let _: proc():Send = proc() foo(x); //~ ERROR does not fulfill `Send` let _: proc():Send = proc() foo(x); //~ ERROR does not fulfill `Send` diff --git a/src/test/compile-fail/lint-heap-memory.rs b/src/test/compile-fail/lint-heap-memory.rs index 26cae1aa70811..2ec9efe9498ce 100644 --- a/src/test/compile-fail/lint-heap-memory.rs +++ b/src/test/compile-fail/lint-heap-memory.rs @@ -12,9 +12,10 @@ #![forbid(heap_memory)] #![allow(dead_code)] +use std::gc::{Gc, GC}; struct Foo { - x: @int //~ ERROR type uses managed + x: Gc, //~ ERROR type uses managed } struct Bar { x: Box } //~ ERROR type uses owned @@ -22,7 +23,7 @@ struct Bar { x: Box } //~ ERROR type uses owned fn main() { let _x : Bar = Bar {x : box 10}; //~ ERROR type uses owned - @2; //~ ERROR type uses managed + box(GC) 2; //~ ERROR type uses managed box 2; //~ ERROR type uses owned fn g(_: Box) {} //~ 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 index ff382cb46c762..5e88f52a9a531 100644 --- a/src/test/compile-fail/lint-managed-heap-memory.rs +++ b/src/test/compile-fail/lint-managed-heap-memory.rs @@ -12,11 +12,13 @@ #![feature(managed_boxes)] #![forbid(managed_heap_memory)] +use std::gc::{Gc, GC}; + struct Foo { - x: @int //~ ERROR type uses managed + x: Gc //~ ERROR type uses managed } fn main() { - let _x : Foo = Foo {x : @10}; + 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 index 543902a7a5580..383a0ac46193f 100644 --- a/src/test/compile-fail/new-box-syntax-bad.rs +++ b/src/test/compile-fail/new-box-syntax-bad.rs @@ -13,7 +13,7 @@ // Tests that the new `box` syntax works with unique pointers and GC pointers. -use std::gc::Gc; +use std::gc::{Gc, GC}; use std::owned::{Box, HEAP}; pub fn main() { diff --git a/src/test/compile-fail/no-send-res-ports.rs b/src/test/compile-fail/no-send-res-ports.rs index 0f7491e231bc0..20edd17556064 100644 --- a/src/test/compile-fail/no-send-res-ports.rs +++ b/src/test/compile-fail/no-send-res-ports.rs @@ -13,8 +13,9 @@ extern crate debug; use std::task; +use std::gc::{Gc, GC}; -struct Port(@T); +struct Port(Gc); fn main() { struct foo { @@ -32,7 +33,7 @@ fn main() { } } - let x = foo(Port(@())); + let x = foo(Port(box(GC) ())); task::spawn(proc() { let y = x; //~ ERROR does not fulfill `Send` diff --git a/src/test/compile-fail/occurs-check.rs b/src/test/compile-fail/occurs-check.rs index fd0da8ba9cf38..0374a6f33f1b5 100644 --- a/src/test/compile-fail/occurs-check.rs +++ b/src/test/compile-fail/occurs-check.rs @@ -10,7 +10,9 @@ #![feature(managed_boxes)] +use std::gc::GC; + fn main() { let f; //~ ERROR cyclic type of infinite size - f = @f; + f = box(GC) f; } diff --git a/src/test/compile-fail/pinned-deep-copy.rs b/src/test/compile-fail/pinned-deep-copy.rs index e118549f2c2e7..aaa09de826b2c 100644 --- a/src/test/compile-fail/pinned-deep-copy.rs +++ b/src/test/compile-fail/pinned-deep-copy.rs @@ -13,9 +13,10 @@ extern crate debug; use std::cell::Cell; +use std::gc::{Gc, GC}; struct r { - i: @Cell, + i: Gc>, } #[unsafe_destructor] @@ -27,7 +28,7 @@ impl Drop for r { } } -fn r(i: @Cell) -> r { +fn r(i: Gc>) -> r { r { i: i } @@ -38,7 +39,7 @@ struct A { } fn main() { - let i = @Cell::new(0); + let i = box(GC) Cell::new(0); { // Can't do this copy let x = box box box A {y: r(i)}; diff --git a/src/test/compile-fail/regions-appearance-constraint.rs b/src/test/compile-fail/regions-appearance-constraint.rs index 68bbebb8cb048..be4bdeedff4de 100644 --- a/src/test/compile-fail/regions-appearance-constraint.rs +++ b/src/test/compile-fail/regions-appearance-constraint.rs @@ -12,9 +12,11 @@ #![feature(managed_boxes)] +use std::gc::GC; + fn testfn(cond: bool) { - let mut x = @3; - let mut y = @4; + let mut x = box(GC) 3; + let mut y = box(GC) 4; let mut a = &*x; @@ -25,11 +27,11 @@ fn testfn(cond: bool) { exp = 4; } - x = @5; //~ERROR cannot assign to `x` because it is borrowed - y = @6; //~ERROR cannot assign to `y` because it is borrowed + x = box(GC) 5; //~ERROR cannot assign to `x` because it is borrowed + y = box(GC) 6; //~ERROR cannot assign to `y` because it is borrowed assert_eq!(*a, exp); - assert_eq!(x, @5); - assert_eq!(y, @6); + assert_eq!(x, box(GC) 5); + assert_eq!(y, box(GC) 6); } 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 1508349344c9a..77988d1867952 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 @@ -10,6 +10,8 @@ #![feature(managed_boxes)] +use std::gc::Gc; + struct point { x: int, y: int, @@ -19,7 +21,7 @@ fn x_coord<'r>(p: &'r point) -> &'r int { return &p.x; } -fn foo(p: @point) -> &int { +fn foo(p: Gc) -> &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 3cd70ce6c8a31..0aff58c34cc23 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 @@ -10,9 +10,11 @@ #![feature(managed_boxes)] +use std::gc::Gc; + fn borrow<'r, T>(x: &'r T) -> &'r T {x} -fn foo(cond: || -> bool, make_box: || -> @int) { +fn foo(cond: || -> bool, make_box: || -> Gc) { 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 6e8013529a937..b5b89ebcc2f2a 100644 --- a/src/test/compile-fail/regions-infer-paramd-indirect.rs +++ b/src/test/compile-fail/regions-infer-paramd-indirect.rs @@ -13,24 +13,26 @@ // 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> = @a<'a>; +type b<'a> = Gc>; struct c<'a> { - f: @b<'a> + f: Gc> } trait set_f<'a> { - fn set_f_ok(&self, b: @b<'a>); - fn set_f_bad(&self, b: @b); + fn set_f_ok(&self, b: Gc>); + fn set_f_bad(&self, b: Gc); } impl<'a> set_f<'a> for c<'a> { - fn set_f_ok(&self, b: @b<'a>) { + fn set_f_ok(&self, b: Gc>) { self.f = b; } - fn set_f_bad(&self, b: @b) { + fn set_f_bad(&self, b: Gc) { self.f = b; //~ ERROR mismatched types: expected `@@&'a int` but found `@@&int` //~^ ERROR cannot infer } diff --git a/src/test/compile-fail/static-region-bound.rs b/src/test/compile-fail/static-region-bound.rs index 4911ceb3ef444..880fbf0cb1d96 100644 --- a/src/test/compile-fail/static-region-bound.rs +++ b/src/test/compile-fail/static-region-bound.rs @@ -10,10 +10,12 @@ #![feature(managed_boxes)] +use std::gc::GC; + fn f(_: T) {} fn main() { - let x = @3; + let x = box(GC) 3; f(x); let x = &3; f(x); //~ ERROR instantiating a type parameter with an incompatible type diff --git a/src/test/compile-fail/struct-field-assignability.rs b/src/test/compile-fail/struct-field-assignability.rs index 68a1726610656..b6ce848a7d8fb 100644 --- a/src/test/compile-fail/struct-field-assignability.rs +++ b/src/test/compile-fail/struct-field-assignability.rs @@ -10,11 +10,13 @@ #![feature(managed_boxes)] +use std::gc::{Gc, GC}; + struct Foo<'a> { x: &'a int } pub fn main() { - let f = Foo { x: @3 }; //~ ERROR borrowed value does not live long enough + let f = Foo { x: box(GC) 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 2fb1d2ffc9d19..31814a2ff1ced 100644 --- a/src/test/compile-fail/terr-sorts.rs +++ b/src/test/compile-fail/terr-sorts.rs @@ -10,12 +10,14 @@ #![feature(managed_boxes)] +use std::gc::Gc; + struct foo { a: int, b: int, } -type bar = @foo; +type bar = Gc; fn want_foo(f: foo) {} fn have_bar(b: bar) { diff --git a/src/test/compile-fail/trait-impl-method-mismatch.rs b/src/test/compile-fail/trait-impl-method-mismatch.rs index e64f76bb4cd77..8df4bb47f8809 100644 --- a/src/test/compile-fail/trait-impl-method-mismatch.rs +++ b/src/test/compile-fail/trait-impl-method-mismatch.rs @@ -10,13 +10,15 @@ #![feature(managed_boxes)] +use std::gc::Gc; + trait Mumbo { - fn jumbo(&self, x: @uint) -> uint; + fn jumbo(&self, x: Gc) -> uint; } impl Mumbo for uint { // Cannot have a larger effect than the trait: - unsafe fn jumbo(&self, x: @uint) { *self + *x; } + unsafe fn jumbo(&self, x: Gc) { *self + *x; } //~^ ERROR expected normal fn but found unsafe fn } diff --git a/src/test/compile-fail/unique-unique-kind.rs b/src/test/compile-fail/unique-unique-kind.rs index 6a62256b88131..e8dc0fc3b6c28 100644 --- a/src/test/compile-fail/unique-unique-kind.rs +++ b/src/test/compile-fail/unique-unique-kind.rs @@ -10,10 +10,12 @@ #![feature(managed_boxes)] +use std::gc::GC; + fn f(_i: T) { } fn main() { - let i = box @100; + let i = box box(GC) 100; f(i); //~ ERROR does not fulfill `Send` } diff --git a/src/test/compile-fail/unique-vec-res.rs b/src/test/compile-fail/unique-vec-res.rs index 91d4c39edcb62..4d10537aa4d04 100644 --- a/src/test/compile-fail/unique-vec-res.rs +++ b/src/test/compile-fail/unique-vec-res.rs @@ -12,9 +12,10 @@ extern crate debug; use std::cell::Cell; +use std::gc::{Gc, GC}; struct r { - i: @Cell, + i: Gc>, } #[unsafe_destructor] @@ -30,8 +31,8 @@ fn f(_i: Vec , _j: Vec ) { } fn main() { - let i1 = @Cell::new(0); - let i2 = @Cell::new(1); + let i1 = box(GC) Cell::new(0); + let i2 = box(GC) Cell::new(1); let r1 = vec!(box r { i: i1 }); let r2 = vec!(box r { i: i2 }); f(r1.clone(), r2.clone()); diff --git a/src/test/compile-fail/unsendable-class.rs b/src/test/compile-fail/unsendable-class.rs index 7c9b2f34ae90f..65f88ef71264b 100644 --- a/src/test/compile-fail/unsendable-class.rs +++ b/src/test/compile-fail/unsendable-class.rs @@ -13,12 +13,14 @@ // Test that a class with an unsendable field can't be // sent +use std::gc::{Gc, GC}; + struct foo { i: int, - j: @String, + j: Gc, } -fn foo(i:int, j: @String) -> foo { +fn foo(i:int, j: Gc) -> foo { foo { i: i, j: j @@ -28,5 +30,5 @@ fn foo(i:int, j: @String) -> foo { fn main() { let cat = "kitty".to_string(); let (tx, _) = channel(); //~ ERROR does not fulfill `Send` - tx.send(foo(42, @(cat))); //~ ERROR does not fulfill `Send` + tx.send(foo(42, box(GC) (cat))); //~ ERROR does not fulfill `Send` } diff --git a/src/test/debuginfo/borrowed-managed-basic.rs b/src/test/debuginfo/borrowed-managed-basic.rs index 85f325859053c..0f81e530fdd36 100644 --- a/src/test/debuginfo/borrowed-managed-basic.rs +++ b/src/test/debuginfo/borrowed-managed-basic.rs @@ -63,47 +63,49 @@ #![allow(unused_variable)] +use std::gc::{Gc, GC}; + fn main() { - let bool_box: @bool = @true; + let bool_box: Gc = box(GC) true; let bool_ref: &bool = bool_box; - let int_box: @int = @-1; + let int_box: Gc = box(GC) -1; let int_ref: &int = int_box; - let char_box: @char = @'a'; + let char_box: Gc = box(GC) 'a'; let char_ref: &char = char_box; - let i8_box: @i8 = @68; + let i8_box: Gc = box(GC) 68; let i8_ref: &i8 = i8_box; - let i16_box: @i16 = @-16; + let i16_box: Gc = box(GC) -16; let i16_ref: &i16 = i16_box; - let i32_box: @i32 = @-32; + let i32_box: Gc = box(GC) -32; let i32_ref: &i32 = i32_box; - let i64_box: @i64 = @-64; + let i64_box: Gc = box(GC) -64; let i64_ref: &i64 = i64_box; - let uint_box: @uint = @1; + let uint_box: Gc = box(GC) 1; let uint_ref: &uint = uint_box; - let u8_box: @u8 = @100; + let u8_box: Gc = box(GC) 100; let u8_ref: &u8 = u8_box; - let u16_box: @u16 = @16; + let u16_box: Gc = box(GC) 16; let u16_ref: &u16 = u16_box; - let u32_box: @u32 = @32; + let u32_box: Gc = box(GC) 32; let u32_ref: &u32 = u32_box; - let u64_box: @u64 = @64; + let u64_box: Gc = box(GC) 64; let u64_ref: &u64 = u64_box; - let f32_box: @f32 = @2.5; + let f32_box: Gc = box(GC) 2.5; let f32_ref: &f32 = f32_box; - let f64_box: @f64 = @3.5; + let f64_box: Gc = box(GC) 3.5; let f64_ref: &f64 = f64_box; zzz(); } diff --git a/src/test/debuginfo/borrowed-struct.rs b/src/test/debuginfo/borrowed-struct.rs index 8ac0745513dac..98b66098862b5 100644 --- a/src/test/debuginfo/borrowed-struct.rs +++ b/src/test/debuginfo/borrowed-struct.rs @@ -48,6 +48,8 @@ #![feature(managed_boxes)] #![allow(unused_variable)] +use std::gc::GC; + struct SomeStruct { x: int, y: f64 @@ -60,7 +62,7 @@ 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 = @SomeStruct { x: 12, y: 25.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; diff --git a/src/test/debuginfo/borrowed-tuple.rs b/src/test/debuginfo/borrowed-tuple.rs index 427981445c1d5..b88161e4a0b30 100644 --- a/src/test/debuginfo/borrowed-tuple.rs +++ b/src/test/debuginfo/borrowed-tuple.rs @@ -31,13 +31,14 @@ #![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: @(i16, f32) = @(-16, -21f32); + 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); diff --git a/src/test/debuginfo/box.rs b/src/test/debuginfo/box.rs index c29d3d88378ed..01129c845e9ea 100644 --- a/src/test/debuginfo/box.rs +++ b/src/test/debuginfo/box.rs @@ -27,11 +27,13 @@ #![feature(managed_boxes)] #![allow(unused_variable)] +use std::gc::GC; + fn main() { let a = box 1; let b = box() (2, 3.5); - let c = @4; - let d = @false; + let c = box(GC) 4; + let d = box(GC) false; _zzz(); } diff --git a/src/test/debuginfo/boxed-struct.rs b/src/test/debuginfo/boxed-struct.rs index 1c94885adaf3a..f583016b93f39 100644 --- a/src/test/debuginfo/boxed-struct.rs +++ b/src/test/debuginfo/boxed-struct.rs @@ -30,6 +30,7 @@ #![feature(managed_boxes)] #![allow(unused_variable)] +use std::gc::GC; struct StructWithSomePadding { x: i16, @@ -52,10 +53,10 @@ impl Drop for StructWithDestructor { fn main() { let unique = box StructWithSomePadding { x: 99, y: 999, z: 9999, w: 99999 }; - let managed = @StructWithSomePadding { x: 88, y: 888, z: 8888, w: 88888 }; + 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 = @StructWithDestructor { x: 33, y: 333, z: 3333, w: 33333 }; + let managed_dtor = box(GC) StructWithDestructor { x: 33, y: 333, z: 3333, w: 33333 }; zzz(); } 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 b626fbad27862..0da2d44d5ae50 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 @@ -36,6 +36,8 @@ // gdb-check:$4 = 8888 // gdb-command:continue +use std::gc::{Gc, GC}; + trait Trait { fn method(self) -> Self; } @@ -66,8 +68,8 @@ impl Trait for (f64, int, int, f64) { } } -impl Trait for @int { - fn method(self) -> @int { +impl Trait for Gc { + fn method(self) -> Gc { zzz(); self } @@ -77,7 +79,7 @@ fn main() { let _ = (1111 as int).method(); let _ = Struct { x: 2222, y: 3333 }.method(); let _ = (4444.5, 5555, 6666, 7777.5).method(); - let _ = (@8888).method(); + let _ = (box(GC) 8888).method(); } fn zzz() {()} diff --git a/src/test/debuginfo/managed-enum.rs b/src/test/debuginfo/managed-enum.rs index 36e75812debdf..bb236a28a8800 100644 --- a/src/test/debuginfo/managed-enum.rs +++ b/src/test/debuginfo/managed-enum.rs @@ -27,6 +27,8 @@ #![allow(unused_variable)] #![feature(struct_variant, managed_boxes)] +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. @@ -50,15 +52,15 @@ fn main() { // 0b01111100011111000111110001111100 = 2088533116 // 0b0111110001111100 = 31868 // 0b01111100 = 124 - let the_a = @TheA { x: 0, y: 8970181431921507452 }; + let the_a = box(GC) TheA { x: 0, y: 8970181431921507452 }; // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441 // 0b00010001000100010001000100010001 = 286331153 // 0b0001000100010001 = 4369 // 0b00010001 = 17 - let the_b = @TheB (0, 286331153, 286331153); + let the_b = box(GC) TheB (0, 286331153, 286331153); - let univariant = @TheOnlyCase(-9747455); + let univariant = box(GC) TheOnlyCase(-9747455); zzz(); } diff --git a/src/test/debuginfo/managed-pointer-within-unique-vec.rs b/src/test/debuginfo/managed-pointer-within-unique-vec.rs index a2a0d171898d2..d1f38be1d8947 100644 --- a/src/test/debuginfo/managed-pointer-within-unique-vec.rs +++ b/src/test/debuginfo/managed-pointer-within-unique-vec.rs @@ -31,9 +31,11 @@ #![allow(unused_variable)] +use std::gc::{Gc, GC}; + fn main() { - let unique: Vec<@i64> = vec!(@10, @11, @12, @13); + let unique: Vec> = vec!(box(GC) 10, box(GC) 11, box(GC) 12, box(GC) 13); zzz(); } diff --git a/src/test/debuginfo/managed-pointer-within-unique.rs b/src/test/debuginfo/managed-pointer-within-unique.rs index be2cc696d4fba..b56db2d18468e 100644 --- a/src/test/debuginfo/managed-pointer-within-unique.rs +++ b/src/test/debuginfo/managed-pointer-within-unique.rs @@ -29,15 +29,17 @@ #![allow(unused_variable)] +use std::gc::{GC, Gc}; + struct ContainsManaged { x: int, - y: @int + y: Gc, } fn main() { let ordinary_unique = box() (-1, -2); - let managed_within_unique = box ContainsManaged { x: -3, y: @-4 }; + let managed_within_unique = box ContainsManaged { x: -3, y: box(GC) -4 }; zzz(); } diff --git a/src/test/debuginfo/recursive-struct.rs b/src/test/debuginfo/recursive-struct.rs index 518ef62fe9a68..ea0867903b5af 100644 --- a/src/test/debuginfo/recursive-struct.rs +++ b/src/test/debuginfo/recursive-struct.rs @@ -106,6 +106,7 @@ #![allow(unused_variable)] #![feature(struct_variant)] +use std::gc::{Gc, GC}; enum Opt { Empty, @@ -118,7 +119,7 @@ struct UniqueNode { } struct ManagedNode { - next: Opt<@ManagedNode>, + next: Opt>>, value: T } @@ -183,7 +184,7 @@ fn main() { value: 2, }; - let box_unique: @UniqueNode = @UniqueNode { + let box_unique: Gc> = box(GC) UniqueNode { next: Val { val: box UniqueNode { next: Empty, @@ -215,7 +216,7 @@ fn main() { let stack_managed: ManagedNode = ManagedNode { next: Val { - val: @ManagedNode { + val: box(GC) ManagedNode { next: Empty, value: 11, } @@ -225,7 +226,7 @@ fn main() { let unique_managed: Box> = box ManagedNode { next: Val { - val: @ManagedNode { + val: box(GC) ManagedNode { next: Empty, value: 13, } @@ -233,9 +234,9 @@ fn main() { value: 12, }; - let box_managed: @ManagedNode = @ManagedNode { + let box_managed: Gc> = box(GC) ManagedNode { next: Val { - val: @ManagedNode { + val: box(GC) ManagedNode { next: Empty, value: 15, } @@ -245,7 +246,7 @@ fn main() { let vec_managed: [ManagedNode, ..1] = [ManagedNode { next: Val { - val: @ManagedNode { + val: box(GC) ManagedNode { next: Empty, value: 17.5, } @@ -255,7 +256,7 @@ fn main() { let borrowed_managed: &ManagedNode = &ManagedNode { next: Val { - val: @ManagedNode { + val: box(GC) ManagedNode { next: Empty, value: 19.5, } diff --git a/src/test/debuginfo/var-captured-in-nested-closure.rs b/src/test/debuginfo/var-captured-in-nested-closure.rs index 787c1cdea800e..3328b11228441 100644 --- a/src/test/debuginfo/var-captured-in-nested-closure.rs +++ b/src/test/debuginfo/var-captured-in-nested-closure.rs @@ -51,6 +51,8 @@ #![feature(managed_boxes)] #![allow(unused_variable)] +use std::gc::GC; + struct Struct { a: int, b: f64, @@ -69,7 +71,7 @@ fn main() { let struct_ref = &a_struct; let owned = box 6; - let managed = @7; + let managed = box(GC) 7; let closure = || { let closure_local = 8; diff --git a/src/test/debuginfo/var-captured-in-stack-closure.rs b/src/test/debuginfo/var-captured-in-stack-closure.rs index fc8093304db14..453ac35463178 100644 --- a/src/test/debuginfo/var-captured-in-stack-closure.rs +++ b/src/test/debuginfo/var-captured-in-stack-closure.rs @@ -31,6 +31,8 @@ #![feature(managed_boxes)] #![allow(unused_variable)] +use std::gc::GC; + struct Struct { a: int, b: f64, @@ -49,7 +51,7 @@ fn main() { let struct_ref = &a_struct; let owned = box 6; - let managed = @7; + let managed = box(GC) 7; let closure = || { zzz(); diff --git a/src/test/pretty/block-disambig.rs b/src/test/pretty/block-disambig.rs index 3ab23beaeb947..20d634d047535 100644 --- a/src/test/pretty/block-disambig.rs +++ b/src/test/pretty/block-disambig.rs @@ -15,33 +15,34 @@ #![feature(managed_boxes)] use std::cell::Cell; +use std::gc::GC; -fn test1() { let val = @0; { } *val; } +fn test1() { let val = box(GC) 0; { } *val; } -fn test2() -> int { let val = @0; { } *val } +fn test2() -> int { let val = box(GC) 0; { } *val } struct S { eax: int } fn test3() { - let regs = @Cell::new(S {eax: 0}); + let regs = box(GC) Cell::new(S {eax: 0}); match true { true => { } _ => { } } regs.set(S {eax: 1}); } -fn test4() -> bool { let regs = @true; if true { } *regs || false } +fn test4() -> bool { let regs = box(GC) true; if true { } *regs || false } fn test5() -> (int, int) { { } (0, 1) } fn test6() -> bool { { } (true || false) && true } fn test7() -> uint { - let regs = @0; + let regs = box(GC) 0; match true { true => { } _ => { } } (*regs < 2) as uint } fn test8() -> int { - let val = @0; + let val = box(GC) 0; match true { true => { } _ => { } @@ -54,12 +55,12 @@ fn test8() -> int { } fn test9() { - let regs = @Cell::new(0); + let regs = box(GC) Cell::new(0); match true { true => { } _ => { } } regs.set(regs.get() + 1); } fn test10() -> int { - let regs = @vec!(0); + let regs = box(GC) vec!(0); 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 a0a11e0029569..54ee90d763cb8 100644 --- a/src/test/run-fail/args-fail.rs +++ b/src/test/run-fail/args-fail.rs @@ -11,6 +11,9 @@ #![feature(managed_boxes)] // error-pattern:meep -fn f(_a: int, _b: int, _c: @int) { fail!("moop"); } -fn main() { f(1, fail!("meep"), @42); } +use std::gc::{Gc, GC}; + +fn f(_a: int, _b: int, _c: Gc) { fail!("moop"); } + +fn main() { f(1, fail!("meep"), box(GC) 42); } diff --git a/src/test/run-fail/issue-2272.rs b/src/test/run-fail/issue-2272.rs index 9ac5790f2b708..df170023dc4a7 100644 --- a/src/test/run-fail/issue-2272.rs +++ b/src/test/run-fail/issue-2272.rs @@ -13,15 +13,16 @@ // 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: @int } +struct Y { z: Gc } fn main() { let _x = X { y: Y { - z: @0 + z: box(GC) 0 }, a: box 0 }; diff --git a/src/test/run-fail/unwind-assert.rs b/src/test/run-fail/unwind-assert.rs index 02c9c6a44ef6e..2f6bd9ad255e0 100644 --- a/src/test/run-fail/unwind-assert.rs +++ b/src/test/run-fail/unwind-assert.rs @@ -12,7 +12,9 @@ #![feature(managed_boxes)] +use std::gc::GC; + fn main() { - let _a = @0; + let _a = box(GC) 0; assert!(false); } diff --git a/src/test/run-fail/unwind-box-fn-unique.rs b/src/test/run-fail/unwind-box-fn-unique.rs index e3507ff450bb6..b513757a4c818 100644 --- a/src/test/run-fail/unwind-box-fn-unique.rs +++ b/src/test/run-fail/unwind-box-fn-unique.rs @@ -14,13 +14,15 @@ extern crate debug; +use std::gc::{GC, Gc}; + fn failfn() { fail!(); } fn main() { let y = box 0; - let x: @proc():Send = @(proc() { + let x: Gc = box(GC) (proc() { println!("{:?}", y.clone()); }); failfn(); diff --git a/src/test/run-fail/unwind-box-res.rs b/src/test/run-fail/unwind-box-res.rs index 0750c1897ee8b..ce24d265504c7 100644 --- a/src/test/run-fail/unwind-box-res.rs +++ b/src/test/run-fail/unwind-box-res.rs @@ -15,6 +15,7 @@ extern crate debug; use std::mem; +use std::gc::GC; fn failfn() { fail!(); @@ -43,7 +44,7 @@ fn main() { let i1 = box 0; let i1p = mem::transmute_copy(&i1); mem::forget(i1); - let x = @r(i1p); + 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 index dd6303ad18348..647d33013a17b 100644 --- a/src/test/run-fail/unwind-box-str.rs +++ b/src/test/run-fail/unwind-box-str.rs @@ -14,12 +14,14 @@ extern crate debug; +use std::gc::GC; + fn failfn() { fail!(); } fn main() { - let x = @"hi".to_string(); + 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 index 9cb17163d11cc..086c4012087ce 100644 --- a/src/test/run-fail/unwind-box-unique-unique.rs +++ b/src/test/run-fail/unwind-box-unique-unique.rs @@ -14,12 +14,14 @@ extern crate debug; +use std::gc::GC; + fn failfn() { fail!(); } fn main() { - let x = @box box 0; + let x = box(GC) box box 0; failfn(); println!("{:?}", x); } diff --git a/src/test/run-fail/unwind-box-unique.rs b/src/test/run-fail/unwind-box-unique.rs index 91681ff3b780f..4add29bc87383 100644 --- a/src/test/run-fail/unwind-box-unique.rs +++ b/src/test/run-fail/unwind-box-unique.rs @@ -14,12 +14,14 @@ extern crate debug; +use std::gc::GC; + fn failfn() { fail!(); } fn main() { - let x = @box 0; + let x = box(GC) box 0; failfn(); println!("{:?}", x); } diff --git a/src/test/run-fail/unwind-box-vec.rs b/src/test/run-fail/unwind-box-vec.rs index 7946812bae58e..f18e55b305e54 100644 --- a/src/test/run-fail/unwind-box-vec.rs +++ b/src/test/run-fail/unwind-box-vec.rs @@ -14,12 +14,14 @@ extern crate debug; +use std::gc::GC; + fn failfn() { fail!(); } fn main() { - let x = @vec!(0, 1, 2, 3, 4, 5); + let x = box(GC) vec!(0, 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 index 9d7a9d113995b..e31f66ed9fb08 100644 --- a/src/test/run-fail/unwind-box.rs +++ b/src/test/run-fail/unwind-box.rs @@ -12,11 +12,13 @@ #![feature(managed_boxes)] +use std::gc::GC; + fn failfn() { fail!(); } fn main() { - @0; + box(GC) 0; failfn(); } diff --git a/src/test/run-fail/unwind-fail.rs b/src/test/run-fail/unwind-fail.rs index 97570ec552e00..5dbfd73c1d7e7 100644 --- a/src/test/run-fail/unwind-fail.rs +++ b/src/test/run-fail/unwind-fail.rs @@ -12,7 +12,9 @@ #![feature(managed_boxes)] +use std::gc::GC; + fn main() { - @0; + box(GC) 0; fail!(); } diff --git a/src/test/run-fail/unwind-initializer-indirect.rs b/src/test/run-fail/unwind-initializer-indirect.rs index acb211e597fdc..e913a80388528 100644 --- a/src/test/run-fail/unwind-initializer-indirect.rs +++ b/src/test/run-fail/unwind-initializer-indirect.rs @@ -8,12 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// error-pattern:fail + #![feature(managed_boxes)] -// error-pattern:fail +use std::gc::Gc; -fn f() -> @int { fail!(); } +fn f() -> Gc { fail!(); } fn main() { - let _a: @int = f(); + let _a: Gc = f(); } diff --git a/src/test/run-fail/unwind-initializer.rs b/src/test/run-fail/unwind-initializer.rs index 6e85491964153..c383aaaf10883 100644 --- a/src/test/run-fail/unwind-initializer.rs +++ b/src/test/run-fail/unwind-initializer.rs @@ -8,12 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// error-pattern:fail + #![feature(managed_boxes)] -// error-pattern:fail +use std::gc::Gc; fn main() { - let _a: @int = { + let _a: Gc = { fail!(); }; } diff --git a/src/test/run-fail/unwind-iter.rs b/src/test/run-fail/unwind-iter.rs index 1b4eebae2d532..8671758c42307 100644 --- a/src/test/run-fail/unwind-iter.rs +++ b/src/test/run-fail/unwind-iter.rs @@ -14,12 +14,14 @@ #![allow(unreachable_code)] #![allow(unused_variable)] +use std::gc::GC; + fn x(it: |int|) { fail!(); it(0); } fn main() { - let a = @0; + let a = box(GC) 0; x(|_i| { } ); } diff --git a/src/test/run-fail/unwind-iter2.rs b/src/test/run-fail/unwind-iter2.rs index b0ec375a5cbd0..d7b950ad5c19f 100644 --- a/src/test/run-fail/unwind-iter2.rs +++ b/src/test/run-fail/unwind-iter2.rs @@ -12,8 +12,10 @@ #![feature(managed_boxes)] +use std::gc::{GC}; + fn x(it: |int|) { - let _a = @0; + let _a = box(GC) 0; it(1); } diff --git a/src/test/run-fail/unwind-lambda.rs b/src/test/run-fail/unwind-lambda.rs index 336df3ff96526..543056afb8260 100644 --- a/src/test/run-fail/unwind-lambda.rs +++ b/src/test/run-fail/unwind-lambda.rs @@ -8,15 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// error-pattern:fail + #![feature(managed_boxes)] -// error-pattern:fail +use std::gc::{Gc, GC}; fn main() { let cheese = "roquefort".to_string(); - let carrots = @"crunchy".to_string(); + let carrots = box(GC) "crunchy".to_string(); - let result: |@String, |String||: 'static = (|tasties, macerate| { + let result: |Gc, |String||: 'static = (|tasties, macerate| { macerate((*tasties).clone()); }); result(carrots, |food| { diff --git a/src/test/run-fail/unwind-match.rs b/src/test/run-fail/unwind-match.rs index 4af77c434829a..4f1e454c39e3f 100644 --- a/src/test/run-fail/unwind-match.rs +++ b/src/test/run-fail/unwind-match.rs @@ -8,12 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(managed_boxes)] - // Issue #945 // error-pattern:non-exhaustive match failure + +#![feature(managed_boxes)] + +use std::gc::GC; + fn test_box() { - @0; + box(GC) 0; } fn test_str() { let res = match false { true => { "happy".to_string() }, diff --git a/src/test/run-fail/unwind-misc-1.rs b/src/test/run-fail/unwind-misc-1.rs index b62755f13b512..00d9309f45831 100644 --- a/src/test/run-fail/unwind-misc-1.rs +++ b/src/test/run-fail/unwind-misc-1.rs @@ -15,15 +15,16 @@ use std::vec; use std::collections; +use std::gc::GC; fn main() { - let _count = @0u; + let _count = box(GC) 0u; let mut map = collections::HashMap::new(); let mut arr = Vec::new(); for _i in range(0u, 10u) { - arr.push(@"key stuff".to_string()); + arr.push(box(GC) "key stuff".to_string()); map.insert(arr.clone(), - arr.clone().append([@"value stuff".to_string()])); + 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 index 99e01391f2019..b1d9f4756c6ad 100644 --- a/src/test/run-fail/unwind-move.rs +++ b/src/test/run-fail/unwind-move.rs @@ -8,14 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// error-pattern:fail + #![feature(managed_boxes)] -// error-pattern:fail -fn f(_a: @int) { +use std::gc::{Gc, GC}; + +fn f(_a: Gc) { fail!(); } fn main() { - let a = @0; + 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 index c52cb3a1ebfa3..b7a12f08c410e 100644 --- a/src/test/run-fail/unwind-nested.rs +++ b/src/test/run-fail/unwind-nested.rs @@ -12,10 +12,12 @@ #![feature(managed_boxes)] +use std::gc::GC; + fn main() { - let _a = @0; + let _a = box(GC) 0; { - let _b = @0; + let _b = box(GC) 0; { fail!(); } diff --git a/src/test/run-fail/unwind-partial-box.rs b/src/test/run-fail/unwind-partial-box.rs index 62b4c1c98cb2b..2bd264d0e3365 100644 --- a/src/test/run-fail/unwind-partial-box.rs +++ b/src/test/run-fail/unwind-partial-box.rs @@ -12,17 +12,18 @@ #![feature(managed_boxes)] +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() { - @0; + box(GC) 0; } fn partial() { - let _x = @f(); + let _x = box(GC) f(); } fn main() { diff --git a/src/test/run-fail/unwind-partial-unique.rs b/src/test/run-fail/unwind-partial-unique.rs index 8d5fcfff963f2..4ea099e9c0f36 100644 --- a/src/test/run-fail/unwind-partial-unique.rs +++ b/src/test/run-fail/unwind-partial-unique.rs @@ -12,13 +12,14 @@ #![feature(managed_boxes)] +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() { - @0; + box(GC) 0; } fn partial() { diff --git a/src/test/run-fail/unwind-partial-vec.rs b/src/test/run-fail/unwind-partial-vec.rs index 92093a90cfd02..e0e043f623ba6 100644 --- a/src/test/run-fail/unwind-partial-vec.rs +++ b/src/test/run-fail/unwind-partial-vec.rs @@ -12,13 +12,14 @@ #![feature(managed_boxes)] +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() { - @0; + box(GC) 0; } fn partial() { diff --git a/src/test/run-fail/unwind-resource-fail.rs b/src/test/run-fail/unwind-resource-fail.rs index 1a7d7d8476369..498d3ee6b0bc1 100644 --- a/src/test/run-fail/unwind-resource-fail.rs +++ b/src/test/run-fail/unwind-resource-fail.rs @@ -12,6 +12,8 @@ // error-pattern:squirrel +use std::gc::GC; + struct r { i: int, } @@ -23,6 +25,6 @@ impl Drop for r { fn r(i: int) -> r { r { i: i } } fn main() { - @0; + box(GC) 0; let _r = r(0); } diff --git a/src/test/run-fail/unwind-resource-fail2.rs b/src/test/run-fail/unwind-resource-fail2.rs index 3e3064e4ee951..add7fe3f0f359 100644 --- a/src/test/run-fail/unwind-resource-fail2.rs +++ b/src/test/run-fail/unwind-resource-fail2.rs @@ -11,6 +11,8 @@ // ignore-test leaks // error-pattern:wombat +use std::gc::GC; + struct r { i: int, } @@ -22,7 +24,7 @@ impl Drop for r { fn r(i: int) -> r { r { i: i } } fn main() { - @0; + 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 index 15db0fbd5cbd1..6252944973d65 100644 --- a/src/test/run-fail/unwind-resource-fail3.rs +++ b/src/test/run-fail/unwind-resource-fail3.rs @@ -12,12 +12,14 @@ // error-pattern:quux +use std::gc::{Gc, GC}; + struct faily_box { - i: @int + i: Gc } // What happens to the box pointer owned by this class? -fn faily_box(i: @int) -> faily_box { faily_box { i: i } } +fn faily_box(i: Gc) -> faily_box { faily_box { i: i } } #[unsafe_destructor] impl Drop for faily_box { @@ -27,5 +29,5 @@ impl Drop for faily_box { } fn main() { - faily_box(@10); + faily_box(box(GC) 10); } diff --git a/src/test/run-fail/unwind-stacked.rs b/src/test/run-fail/unwind-stacked.rs index eb0e69fe87784..da6205e9e3734 100644 --- a/src/test/run-fail/unwind-stacked.rs +++ b/src/test/run-fail/unwind-stacked.rs @@ -12,17 +12,19 @@ #![feature(managed_boxes)] +use std::gc::GC; + fn f() { - let _a = @0; + let _a = box(GC) 0; fail!(); } fn g() { - let _b = @0; + let _b = box(GC) 0; f(); } fn main() { - let _a = @0; + let _a = box(GC) 0; g(); } diff --git a/src/test/run-fail/unwind-tup.rs b/src/test/run-fail/unwind-tup.rs index 7108d4df54f25..08a22a7c355b7 100644 --- a/src/test/run-fail/unwind-tup.rs +++ b/src/test/run-fail/unwind-tup.rs @@ -10,10 +10,11 @@ #![feature(managed_boxes)] +use std::gc::Gc; // error-pattern:fail -fn fold_local() -> @Vec { +fn fold_local() -> Gc> { fail!(); } diff --git a/src/test/run-fail/unwind-tup2.rs b/src/test/run-fail/unwind-tup2.rs index ca77f69253385..26073531dd305 100644 --- a/src/test/run-fail/unwind-tup2.rs +++ b/src/test/run-fail/unwind-tup2.rs @@ -10,14 +10,15 @@ #![feature(managed_boxes)] +use std::gc::{Gc, GC}; // error-pattern:fail -fn fold_local() -> @Vec { - @vec!(0,0,0,0,0,0) +fn fold_local() -> Gc> { + box(GC) vec!(0,0,0,0,0,0) } -fn fold_remote() -> @Vec { +fn fold_remote() -> Gc> { fail!(); } diff --git a/src/test/run-fail/unwind-uninitialized.rs b/src/test/run-fail/unwind-uninitialized.rs index a70585d6b1d76..acba93f7be3ba 100644 --- a/src/test/run-fail/unwind-uninitialized.rs +++ b/src/test/run-fail/unwind-uninitialized.rs @@ -12,11 +12,13 @@ #![feature(managed_boxes)] +use std::gc::GC; + fn f() { fail!(); } fn main() { f(); - let _a = @0; + let _a = box(GC) 0; } diff --git a/src/test/run-pass-fulldeps/quote-tokens.rs b/src/test/run-pass-fulldeps/quote-tokens.rs index 4b2e29135ad2e..59bf0bff5d880 100644 --- a/src/test/run-pass-fulldeps/quote-tokens.rs +++ b/src/test/run-pass-fulldeps/quote-tokens.rs @@ -17,22 +17,23 @@ extern crate syntax; use syntax::ext::base::ExtCtxt; +use std::gc::Gc; fn syntax_extension(cx: &ExtCtxt) { let e_toks : Vec = quote_tokens!(cx, 1 + 2); let p_toks : Vec = quote_tokens!(cx, (x, 1 .. 4, *)); - let a: @syntax::ast::Expr = quote_expr!(cx, 1 + 2); - let _b: Option<@syntax::ast::Item> = quote_item!(cx, static foo : int = $e_toks; ); - let _c: @syntax::ast::Pat = quote_pat!(cx, (x, 1 .. 4, *) ); - let _d: @syntax::ast::Stmt = quote_stmt!(cx, let x = $a; ); - let _e: @syntax::ast::Expr = quote_expr!(cx, match foo { $p_toks => 10 } ); + let a: Gc = quote_expr!(cx, 1 + 2); + let _b: Option> = quote_item!(cx, static foo : int = $e_toks; ); + let _c: Gc = quote_pat!(cx, (x, 1 .. 4, *) ); + let _d: Gc = quote_stmt!(cx, let x = $a; ); + let _e: Gc = quote_expr!(cx, match foo { $p_toks => 10 } ); - let _f: @syntax::ast::Expr = quote_expr!(cx, ()); - let _g: @syntax::ast::Expr = quote_expr!(cx, true); - let _h: @syntax::ast::Expr = quote_expr!(cx, 'a'); + let _f: Gc = quote_expr!(cx, ()); + let _g: Gc = quote_expr!(cx, true); + let _h: Gc = quote_expr!(cx, 'a'); - let i: Option<@syntax::ast::Item> = quote_item!(cx, #[deriving(Eq)] struct Foo; ); + let i: Option> = quote_item!(cx, #[deriving(Eq)] struct Foo; ); assert!(i.is_some()); } diff --git a/src/test/run-pass/assert-eq-macro-success.rs b/src/test/run-pass/assert-eq-macro-success.rs index 34f7bf6f0e780..debe4d8ea53ac 100644 --- a/src/test/run-pass/assert-eq-macro-success.rs +++ b/src/test/run-pass/assert-eq-macro-success.rs @@ -10,6 +10,8 @@ #![feature(managed_boxes)] +use std::gc::GC; + #[deriving(PartialEq, Show)] struct Point { x : int } @@ -18,5 +20,5 @@ 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!(@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 a9bfd78794dc5..acb3e43fbfc4b 100644 --- a/src/test/run-pass/autoderef-method-priority.rs +++ b/src/test/run-pass/autoderef-method-priority.rs @@ -10,6 +10,8 @@ #![feature(managed_boxes)] +use std::gc::{GC, Gc}; + trait double { fn double(self) -> uint; } @@ -18,11 +20,11 @@ impl double for uint { fn double(self) -> uint { self } } -impl double for @uint { +impl double for Gc { fn double(self) -> uint { *self * 2u } } pub fn main() { - let x = @3u; + let x = box(GC) 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 270f85114ea49..ee4431609cc15 100644 --- a/src/test/run-pass/autoref-intermediate-types-issue-3585.rs +++ b/src/test/run-pass/autoref-intermediate-types-issue-3585.rs @@ -10,13 +10,15 @@ #![feature(managed_boxes)] +use std::gc::{Gc, GC}; + trait Foo { fn foo(&self) -> String; } -impl Foo for @T { +impl Foo for Gc { fn foo(&self) -> String { - format!("@{}", (**self).foo()) + format!("box(GC) {}", (**self).foo()) } } @@ -27,6 +29,6 @@ impl Foo for uint { } pub fn main() { - let x = @3u; - assert_eq!(x.foo(), "@3".to_string()); + let x = box(GC) 3u; + assert_eq!(x.foo(), "box(GC) 3".to_string()); } diff --git a/src/test/run-pass/binops.rs b/src/test/run-pass/binops.rs index 3ac3ac2b4f1b4..9c1b64004a2bf 100644 --- a/src/test/run-pass/binops.rs +++ b/src/test/run-pass/binops.rs @@ -12,6 +12,8 @@ #![feature(managed_boxes)] +use std::gc::GC; + fn test_nil() { assert_eq!((), ()); assert!((!(() != ()))); @@ -45,7 +47,7 @@ fn test_bool() { } fn test_box() { - assert_eq!(@10, @10); + assert_eq!(box(GC) 10, box(GC) 10); } fn test_ptr() { 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 2db2f8c16e06b..dd1224929c7f3 100644 --- a/src/test/run-pass/borrowck-borrow-from-expr-block.rs +++ b/src/test/run-pass/borrowck-borrow-from-expr-block.rs @@ -10,12 +10,13 @@ #![feature(managed_boxes)] +use std::gc::{Gc, GC}; fn borrow(x: &int, f: |x: &int|) { f(x) } -fn test1(x: @Box) { +fn test1(x: Gc>) { borrow(&*(*x).clone(), |p| { let x_a = &**x as *int; assert!((x_a as uint) != (p as *int as uint)); @@ -24,5 +25,5 @@ fn test1(x: @Box) { } pub fn main() { - test1(@box 22); + test1(box(GC) 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 index b9ccda05e4bb2..b75b391a23933 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-moved-value.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-moved-value.rs @@ -15,22 +15,24 @@ #![feature(managed_boxes)] -fn free(x: @T) {} +use std::gc::{Gc, GC}; + +fn free(x: Gc) {} struct Foo { - f: @Bar + f: Gc } struct Bar { g: int } -fn lend(x: @Foo) -> 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(@Foo {f: @Bar {g: 22}}), 22); + 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 index aa0ff316239df..329db099e41fd 100644 --- a/src/test/run-pass/borrowck-root-while-cond-2.rs +++ b/src/test/run-pass/borrowck-root-while-cond-2.rs @@ -10,11 +10,12 @@ #![feature(managed_boxes)] +use std::gc::{GC, Gc}; -struct F { f: @G } +struct F { f: Gc } struct G { g: Vec } pub fn main() { - let rec = @F {f: @G {g: vec!(1, 2, 3)}}; + 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 index b9961f44c736d..eda8637adc4cf 100644 --- a/src/test/run-pass/borrowck-root-while-cond.rs +++ b/src/test/run-pass/borrowck-root-while-cond.rs @@ -10,12 +10,13 @@ #![feature(managed_boxes)] +use std::gc::{Gc, GC}; fn borrow<'r,T>(x: &'r T) -> &'r T {x} -struct Rec { f: @int } +struct Rec { f: Gc } pub fn main() { - let rec = @Rec {f: @22}; + 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 7704d7eb262d1..b096ff3de1f3c 100644 --- a/src/test/run-pass/borrowck-univariant-enum.rs +++ b/src/test/run-pass/borrowck-univariant-enum.rs @@ -11,6 +11,7 @@ #![feature(managed_boxes)] use std::cell::Cell; +use std::gc::GC; enum newtype { newtype(int) @@ -21,8 +22,8 @@ pub fn main() { // Test that borrowck treats enums with a single variant // specially. - let x = @Cell::new(5); - let y = @Cell::new(newtype(3)); + let x = box(GC) Cell::new(5); + let y = box(GC) Cell::new(newtype(3)); let z = match y.get() { newtype(b) => { x.set(x.get() + 1); diff --git a/src/test/run-pass/box-compare.rs b/src/test/run-pass/box-compare.rs index ba41b1ffe9d03..facd390620fb5 100644 --- a/src/test/run-pass/box-compare.rs +++ b/src/test/run-pass/box-compare.rs @@ -10,8 +10,12 @@ #![feature(managed_boxes)] +use std::gc::GC; + pub fn main() { - assert!((@1 < @3)); - assert!((@@"hello ".to_string() > @@"hello".to_string())); - assert!((@@@"hello".to_string() != @@@"there".to_string())); + assert!((box(GC) 1 < box(GC) 3)); + 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 index 2934e86b3f7d4..7959bd385d3db 100644 --- a/src/test/run-pass/box-in-tup.rs +++ b/src/test/run-pass/box-in-tup.rs @@ -10,7 +10,9 @@ #![feature(managed_boxes)] +use std::gc::{Gc, GC}; + pub fn main() { - let i: (@int, int) = (@10, 10); + 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 index 85284be38991e..3f11f8b240b30 100644 --- a/src/test/run-pass/box-inside-if.rs +++ b/src/test/run-pass/box-inside-if.rs @@ -10,11 +10,13 @@ #![feature(managed_boxes)] -fn some_box(x: int) -> @int { return @x; } +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: @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"); } diff --git a/src/test/run-pass/box-inside-if2.rs b/src/test/run-pass/box-inside-if2.rs index fc7e0d5e7228a..d494d2d7e8176 100644 --- a/src/test/run-pass/box-inside-if2.rs +++ b/src/test/run-pass/box-inside-if2.rs @@ -10,11 +10,13 @@ #![feature(managed_boxes)] -fn some_box(x: int) -> @int { return @x; } +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: @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"); } diff --git a/src/test/run-pass/box-unbox.rs b/src/test/run-pass/box-unbox.rs index c78ea59c10ded..d360474cc9c52 100644 --- a/src/test/run-pass/box-unbox.rs +++ b/src/test/run-pass/box-unbox.rs @@ -10,13 +10,15 @@ #![feature(managed_boxes)] -struct Box {c: @T} +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: @foo}; + 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 index 5f9b5a4b81447..4c368b78b2d79 100644 --- a/src/test/run-pass/box.rs +++ b/src/test/run-pass/box.rs @@ -10,4 +10,6 @@ #![feature(managed_boxes)] -pub fn main() { let x: @int = @10; assert!((*x == 10)); } +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 index 88823ba1105cb..377d27d1d456d 100644 --- a/src/test/run-pass/boxed-class-type-substitution.rs +++ b/src/test/run-pass/boxed-class-type-substitution.rs @@ -13,6 +13,8 @@ #![feature(managed_boxes)] +use std::gc::Gc; + struct Tree { parent: Option } @@ -20,7 +22,7 @@ struct Tree { fn empty() -> Tree { fail!() } struct Box { - tree: Tree<@Box> + tree: Tree> } fn Box() -> Box { @@ -30,7 +32,7 @@ fn Box() -> Box { } struct LayoutData { - a_box: Option<@Box> + 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 081a756af69dd..324fb428df019 100644 --- a/src/test/run-pass/cci_borrow.rs +++ b/src/test/run-pass/cci_borrow.rs @@ -14,9 +14,10 @@ extern crate cci_borrow_lib; use cci_borrow_lib::foo; +use std::gc::GC; pub fn main() { - let p = @22u; + let p = box(GC) 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 ca87d7b311a5a..b8989afcff3bc 100644 --- a/src/test/run-pass/classes-self-referential.rs +++ b/src/test/run-pass/classes-self-referential.rs @@ -10,6 +10,8 @@ #![feature(managed_boxes)] +use std::gc::Gc; + struct kitten { cat: Option, } @@ -20,6 +22,6 @@ fn kitten(cat: Option) -> kitten { } } -type cat = @kitten; +type cat = Gc; pub fn main() {} diff --git a/src/test/run-pass/cleanup-copy-mode.rs b/src/test/run-pass/cleanup-copy-mode.rs index 007349c6ec1c7..58e4d1a7aab93 100644 --- a/src/test/run-pass/cleanup-copy-mode.rs +++ b/src/test/run-pass/cleanup-copy-mode.rs @@ -11,11 +11,12 @@ #![feature(managed_boxes)] use std::task; +use std::gc::{GC, Gc}; -fn adder(x: @int, y: @int) -> int { return *x + *y; } -fn failer() -> @int { fail!(); } +fn adder(x: Gc, y: Gc) -> int { return *x + *y; } +fn failer() -> Gc { fail!(); } pub fn main() { assert!(task::try(proc() { - adder(@2, failer()); () + 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 456f7ec3e99f3..13ca344cc4e76 100644 --- a/src/test/run-pass/crate-method-reexport-grrrrrrr.rs +++ b/src/test/run-pass/crate-method-reexport-grrrrrrr.rs @@ -18,10 +18,12 @@ 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 = @(); + let x = box(GC) (); 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 index 3737aa7cc866f..277f3e40c41ef 100644 --- a/src/test/run-pass/cycle-collection.rs +++ b/src/test/run-pass/cycle-collection.rs @@ -11,14 +11,15 @@ #![feature(managed_boxes)] use std::cell::RefCell; +use std::gc::{Gc, GC}; enum taggy { - cons(@RefCell), + cons(Gc>), nil, } fn f() { - let a_box = @RefCell::new(nil); + let a_box = box(GC) RefCell::new(nil); *a_box.borrow_mut() = cons(a_box); } diff --git a/src/test/run-pass/deref-lval.rs b/src/test/run-pass/deref-lval.rs index 122c4b47310c7..f507956960639 100644 --- a/src/test/run-pass/deref-lval.rs +++ b/src/test/run-pass/deref-lval.rs @@ -13,9 +13,10 @@ extern crate debug; use std::cell::Cell; +use std::gc::GC; pub fn main() { - let x = @Cell::new(5); + let x = box(GC) Cell::new(5); x.set(1000); println!("{:?}", x.get()); } diff --git a/src/test/run-pass/deref.rs b/src/test/run-pass/deref.rs index fdc3a106e02cb..3d29b7bca8b65 100644 --- a/src/test/run-pass/deref.rs +++ b/src/test/run-pass/deref.rs @@ -10,7 +10,9 @@ #![feature(managed_boxes)] +use std::gc::{Gc, GC}; + pub fn main() { - let x: @int = @10; + let x: Gc = box(GC) 10; let _y: int = *x; } diff --git a/src/test/run-pass/double-unbox.rs b/src/test/run-pass/double-unbox.rs index 9a3c38d45b4cf..d019b191a5e27 100644 --- a/src/test/run-pass/double-unbox.rs +++ b/src/test/run-pass/double-unbox.rs @@ -10,11 +10,13 @@ #![feature(managed_boxes)] +use std::gc::Gc; + struct Quux { bar: int } fn g(_i: int) { } -fn f(foo: @@Quux) { g(foo.bar); } +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 da23a1ebd07a6..56a2e55fea5d1 100644 --- a/src/test/run-pass/drop-on-empty-block-exit.rs +++ b/src/test/run-pass/drop-on-empty-block-exit.rs @@ -10,9 +10,11 @@ #![feature(managed_boxes)] -enum t { foo(@int), } +use std::gc::{Gc, GC}; + +enum t { foo(Gc), } pub fn main() { - let tt = foo(@10); + let tt = foo(box(GC) 10); match tt { foo(_z) => { } } } diff --git a/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs b/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs index acd1846407ec1..4ddff8d899afe 100644 --- a/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs +++ b/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs @@ -16,9 +16,11 @@ * represented with nullable pointers could be misoptimized in some cases. */ -enum List { Nil, Cons(X, @List) } +use std::gc::{Gc, GC}; + +enum List { Nil, Cons(X, Gc>) } pub fn main() { - match Cons(10, @Nil) { + match Cons(10, box(GC) Nil) { Cons(10, _) => {} Nil => {} _ => fail!() diff --git a/src/test/run-pass/evec-internal-boxes.rs b/src/test/run-pass/evec-internal-boxes.rs index 5bf89ce7de266..d9495642abb3d 100644 --- a/src/test/run-pass/evec-internal-boxes.rs +++ b/src/test/run-pass/evec-internal-boxes.rs @@ -11,10 +11,12 @@ #![feature(managed_boxes)] #![allow(dead_assignment)] +use std::gc::{Gc, GC}; + pub fn main() { - let x : [@int, ..5] = [@1,@2,@3,@4,@5]; - let _y : [@int, ..5] = [@1,@2,@3,@4,@5]; - let mut z = [@1,@2,@3,@4,@5]; + 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 3e079af56ebf9..7cdc83e0f0756 100644 --- a/src/test/run-pass/export-non-interference.rs +++ b/src/test/run-pass/export-non-interference.rs @@ -10,6 +10,8 @@ #![feature(managed_boxes)] -enum list_cell { cons(@list_cell), nil } +use std::gc::Gc; + +enum list_cell { cons(Gc>), nil } pub fn main() { } diff --git a/src/test/run-pass/expr-block-box.rs b/src/test/run-pass/expr-block-box.rs index c9554246eba07..b9d005d945fb1 100644 --- a/src/test/run-pass/expr-block-box.rs +++ b/src/test/run-pass/expr-block-box.rs @@ -10,4 +10,6 @@ #![feature(managed_boxes)] -pub fn main() { let x = { @100 }; assert!((*x == 100)); } +use std::gc::GC; + +pub fn main() { let x = { box(GC) 100 }; 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 index 623a93292c642..7c79861ef2a74 100644 --- a/src/test/run-pass/expr-block-generic-box1.rs +++ b/src/test/run-pass/expr-block-generic-box1.rs @@ -10,20 +10,22 @@ #![feature(managed_boxes)] -type compare = |@T, @T|: 'static -> bool; +use std::gc::{Gc, GC}; -fn test_generic(expected: @T, eq: compare) { - let actual: @T = { expected }; +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: @bool, b2: @bool) -> bool { + fn compare_box(b1: Gc, b2: Gc) -> bool { println!("{}", *b1); println!("{}", *b2); return *b1 == *b2; } - test_generic::(@true, compare_box); + 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 index cb690a86f810b..e49728e5176bb 100644 --- a/src/test/run-pass/expr-block-generic-box2.rs +++ b/src/test/run-pass/expr-block-generic-box2.rs @@ -10,6 +10,7 @@ #![feature(managed_boxes)] +use std::gc::{GC, Gc}; type compare<'a, T> = |T, T|: 'a -> bool; @@ -19,8 +20,8 @@ fn test_generic(expected: T, eq: compare) { } fn test_vec() { - fn compare_vec(v1: @int, v2: @int) -> bool { return v1 == v2; } - test_generic::<@int>(@1, compare_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 index 400c9f8023a31..df7ea0c943b38 100644 --- a/src/test/run-pass/expr-block-ref.rs +++ b/src/test/run-pass/expr-block-ref.rs @@ -10,5 +10,7 @@ #![feature(managed_boxes)] +use std::gc::GC; + // Regression test for issue #388 -pub fn main() { let _x = { { @10 } }; } +pub fn main() { let _x = { { box(GC) 10 } }; } diff --git a/src/test/run-pass/expr-elseif-ref.rs b/src/test/run-pass/expr-elseif-ref.rs index f8ae245ee29b8..0753606a6632d 100644 --- a/src/test/run-pass/expr-elseif-ref.rs +++ b/src/test/run-pass/expr-elseif-ref.rs @@ -10,10 +10,12 @@ #![feature(managed_boxes)] +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: @uint = @10u; + 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 index 1b52235ef871c..51e3df7b26b5b 100644 --- a/src/test/run-pass/expr-elseif-ref2.rs +++ b/src/test/run-pass/expr-elseif-ref2.rs @@ -10,13 +10,15 @@ #![feature(managed_boxes)] +use std::gc::{GC}; + // Regression test for issue #388 pub fn main() { let _x = if false { - @0u + box(GC) 0u } else if true { - @10u + box(GC) 10u } else { - @0u + box(GC) 0u }; } diff --git a/src/test/run-pass/expr-if-box.rs b/src/test/run-pass/expr-if-box.rs index 3918f7eb73d80..e1c6de0bf6bd2 100644 --- a/src/test/run-pass/expr-if-box.rs +++ b/src/test/run-pass/expr-if-box.rs @@ -10,9 +10,11 @@ #![feature(managed_boxes)] +use std::gc::{Gc, GC}; + // Tests for if as expressions returning boxed types fn test_box() { - let rs = if true { @100 } else { @101 }; + let rs = if true { box(GC) 100 } else { box(GC) 101 }; assert_eq!(*rs, 100); } diff --git a/src/test/run-pass/expr-if-generic-box1.rs b/src/test/run-pass/expr-if-generic-box1.rs index fdb39b227e0b8..24216296ea2b3 100644 --- a/src/test/run-pass/expr-if-generic-box1.rs +++ b/src/test/run-pass/expr-if-generic-box1.rs @@ -10,16 +10,18 @@ #![feature(managed_boxes)] -type compare = |@T, @T|: 'static -> bool; +use std::gc::{GC, Gc}; -fn test_generic(expected: @T, not_expected: @T, eq: compare) { - let actual: @T = if true { expected } else { not_expected }; +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: @bool, b2: @bool) -> bool { return *b1 == *b2; } - test_generic::(@true, @false, compare_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 index 47c46442f0b1a..9c5d363577d34 100644 --- a/src/test/run-pass/expr-if-generic-box2.rs +++ b/src/test/run-pass/expr-if-generic-box2.rs @@ -10,6 +10,7 @@ #![feature(managed_boxes)] +use std::gc::{Gc, GC}; type compare = |T, T|: 'static -> bool; @@ -19,8 +20,8 @@ fn test_generic(expected: T, not_expected: T, eq: compare) { } fn test_vec() { - fn compare_box(v1: @int, v2: @int) -> bool { return v1 == v2; } - test_generic::<@int>(@1, @2, compare_box); + 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 index 457d3e8d98642..98218829d34a1 100644 --- a/src/test/run-pass/expr-match-box.rs +++ b/src/test/run-pass/expr-match-box.rs @@ -10,9 +10,11 @@ #![feature(managed_boxes)] +use std::gc::GC; + // Tests for match as expressions resulting in boxed types fn test_box() { - let res = match true { true => { @100 } _ => fail!("wat") }; + let res = match true { true => { box(GC) 100 } _ => fail!("wat") }; assert_eq!(*res, 100); } diff --git a/src/test/run-pass/expr-match-generic-box1.rs b/src/test/run-pass/expr-match-generic-box1.rs index 3f107a0eb2f7f..0a7442ce2cd21 100644 --- a/src/test/run-pass/expr-match-generic-box1.rs +++ b/src/test/run-pass/expr-match-generic-box1.rs @@ -10,16 +10,18 @@ #![feature(managed_boxes)] -type compare = |@T, @T|: 'static -> bool; +use std::gc::{Gc, GC}; -fn test_generic(expected: @T, eq: compare) { - let actual: @T = match true { true => { expected }, _ => fail!() }; +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: @bool, b2: @bool) -> bool { return *b1 == *b2; } - test_generic::(@true, compare_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 index 802e96e840c51..304cde1ccdd96 100644 --- a/src/test/run-pass/expr-match-generic-box2.rs +++ b/src/test/run-pass/expr-match-generic-box2.rs @@ -10,6 +10,7 @@ #![feature(managed_boxes)] +use std::gc::{Gc, GC}; type compare = |T, T|: 'static -> bool; @@ -19,8 +20,8 @@ fn test_generic(expected: T, eq: compare) { } fn test_vec() { - fn compare_box(v1: @int, v2: @int) -> bool { return v1 == v2; } - test_generic::<@int>(@1, compare_box); + 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 08bdeab4e2dad..6c4ab3bac5bb2 100644 --- a/src/test/run-pass/exterior.rs +++ b/src/test/run-pass/exterior.rs @@ -11,10 +11,11 @@ #![feature(managed_boxes)] use std::cell::Cell; +use std::gc::{Gc, GC}; struct Point {x: int, y: int, z: int} -fn f(p: @Cell) { +fn f(p: Gc>) { assert!((p.get().z == 12)); p.set(Point {x: 10, y: 11, z: 13}); assert!((p.get().z == 13)); @@ -22,7 +23,7 @@ fn f(p: @Cell) { pub fn main() { let a: Point = Point {x: 10, y: 11, z: 12}; - let b: @Cell = @Cell::new(a); + let b: Gc> = box(GC) Cell::new(a); assert_eq!(b.get().z, 12); f(b); assert_eq!(a.z, 12); diff --git a/src/test/run-pass/generic-alias-box.rs b/src/test/run-pass/generic-alias-box.rs index 1d1e4864acb1e..7664d75cfb7bb 100644 --- a/src/test/run-pass/generic-alias-box.rs +++ b/src/test/run-pass/generic-alias-box.rs @@ -12,11 +12,13 @@ extern crate debug; +use std::gc::{Gc, GC}; + fn id(t: T) -> T { return t; } pub fn main() { - let expected = @100; - let actual = id::<@int>(expected); + 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 index bb2100a9c980a..fa3f971a7f0ed 100644 --- a/src/test/run-pass/generic-box.rs +++ b/src/test/run-pass/generic-box.rs @@ -10,11 +10,13 @@ #![feature(managed_boxes)] -fn box_it(x: Box) -> @Box { return @x; } +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: @Box = box_it::(Box{x: 1, y: 2, z: 3}); + 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 index 0d05e620c6c3e..4863b61ed256d 100644 --- a/src/test/run-pass/generic-drop-glue.rs +++ b/src/test/run-pass/generic-drop-glue.rs @@ -10,8 +10,10 @@ #![feature(managed_boxes)] -struct Pair { x: @int, y: @int } +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: @10, y: @12}; f(x); } +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 index d7e5aa9b9f000..43cf655582133 100644 --- a/src/test/run-pass/generic-exterior-box.rs +++ b/src/test/run-pass/generic-exterior-box.rs @@ -10,9 +10,11 @@ #![feature(managed_boxes)] -struct Recbox {x: @T} +use std::gc::{Gc, GC}; -fn reclift(t: T) -> Recbox { return Recbox {x: @t}; } +struct Recbox {x: Gc} + +fn reclift(t: T) -> Recbox { return Recbox {x: box(GC) t}; } pub fn main() { let foo: int = 17; diff --git a/src/test/run-pass/generic-fn-box.rs b/src/test/run-pass/generic-fn-box.rs index d162daf7cecfd..ef90eb2fa5262 100644 --- a/src/test/run-pass/generic-fn-box.rs +++ b/src/test/run-pass/generic-fn-box.rs @@ -12,6 +12,8 @@ extern crate debug; -fn f(x: @T) -> @T { return x; } +use std::gc::{Gc, GC}; -pub fn main() { let x = f(@3); println!("{:?}", *x); } +fn f(x: Gc) -> Gc { return x; } + +pub fn main() { let x = f(box(GC) 3); println!("{:?}", *x); } diff --git a/src/test/run-pass/generic-ivec.rs b/src/test/run-pass/generic-ivec.rs index 61279df68aabc..18d1b7f03a1d0 100644 --- a/src/test/run-pass/generic-ivec.rs +++ b/src/test/run-pass/generic-ivec.rs @@ -10,5 +10,7 @@ #![feature(managed_boxes)] -fn f(_v: @T) { } -pub fn main() { f(@vec!(1, 2, 3, 4, 5)); } +use std::gc::{Gc, GC}; + +fn f(_v: Gc) { } +pub fn main() { f(box(GC) vec!(1, 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 d07cee79fad08..2f8b07e364e6a 100644 --- a/src/test/run-pass/generic-recursive-tag.rs +++ b/src/test/run-pass/generic-recursive-tag.rs @@ -12,9 +12,14 @@ #![feature(managed_boxes)] -enum list { cons(@T, @list), nil, } +use std::gc::{Gc, GC}; + +enum list { cons(Gc, Gc>), nil, } pub fn main() { let _a: list = - cons::(@10, @cons::(@12, @cons::(@13, @nil::))); + cons::(box(GC) 10, + box(GC) cons::(box(GC) 12, + box(GC) cons::(box(GC) 13, + box(GC) nil::))); } diff --git a/src/test/run-pass/generic-tag.rs b/src/test/run-pass/generic-tag.rs index d765354aa5970..1a0cc14f02ef8 100644 --- a/src/test/run-pass/generic-tag.rs +++ b/src/test/run-pass/generic-tag.rs @@ -12,9 +12,11 @@ #![allow(dead_assignment)] #![allow(unused_variable)] -enum option { some(@T), none, } +use std::gc::{Gc, GC}; + +enum option { some(Gc), none, } pub fn main() { - let mut a: option = some::(@10); + let mut a: option = some::(box(GC) 10); a = none::; } diff --git a/src/test/run-pass/ifmt.rs b/src/test/run-pass/ifmt.rs index e00b3bb64bd3b..6638b80680ec8 100644 --- a/src/test/run-pass/ifmt.rs +++ b/src/test/run-pass/ifmt.rs @@ -17,6 +17,7 @@ extern crate debug; use std::fmt; +use std::gc::GC; use std::io::MemWriter; use std::io; use std::str; @@ -42,7 +43,7 @@ pub fn main() { t!(format!("{:?}", 1), "1"); t!(format!("{:?}", A), "A"); t!(format!("{:?}", ()), "()"); - t!(format!("{:?}", @(box 1, "foo")), "@(box 1, \"foo\")"); + t!(format!("{:?}", box(GC) (box 1, "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 c573ca9184071..4c05103973f49 100644 --- a/src/test/run-pass/init-res-into-things.rs +++ b/src/test/run-pass/init-res-into-things.rs @@ -11,12 +11,13 @@ #![feature(managed_boxes)] 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: @Cell, + i: Gc>, } struct Box { x: r } @@ -28,22 +29,22 @@ impl Drop for r { } } -fn r(i: @Cell) -> r { +fn r(i: Gc>) -> r { r { i: i } } fn test_box() { - let i = @Cell::new(0); + let i = box(GC) Cell::new(0); { - let _a = @r(i); + let _a = box(GC) r(i); } assert_eq!(i.get(), 1); } fn test_rec() { - let i = @Cell::new(0); + let i = box(GC) Cell::new(0); { let _a = Box {x: r(i)}; } @@ -55,7 +56,7 @@ fn test_tag() { t0(r), } - let i = @Cell::new(0); + let i = box(GC) Cell::new(0); { let _a = t0(r(i)); } @@ -63,7 +64,7 @@ fn test_tag() { } fn test_tup() { - let i = @Cell::new(0); + let i = box(GC) Cell::new(0); { let _a = (r(i), 0); } @@ -71,7 +72,7 @@ fn test_tup() { } fn test_unique() { - let i = @Cell::new(0); + let i = box(GC) Cell::new(0); { let _a = box r(i); } @@ -79,9 +80,9 @@ fn test_unique() { } fn test_box_rec() { - let i = @Cell::new(0); + let i = box(GC) Cell::new(0); { - let _a = @Box { + let _a = box(GC) Box { x: r(i) }; } diff --git a/src/test/run-pass/issue-2631-b.rs b/src/test/run-pass/issue-2631-b.rs index 5f2f2c4b1b505..3c353e0ac3ad1 100644 --- a/src/test/run-pass/issue-2631-b.rs +++ b/src/test/run-pass/issue-2631-b.rs @@ -18,10 +18,11 @@ extern crate req; use req::request; use std::cell::RefCell; use std::collections::HashMap; +use std::gc::GC; pub fn main() { - let v = vec!(@"hi".to_string()); + let v = vec!(box(GC) "hi".to_string()); let mut m: req::header_map = HashMap::new(); - m.insert("METHOD".to_string(), @RefCell::new(v)); + m.insert("METHOD".to_string(), box(GC) RefCell::new(v)); request::(&m); } diff --git a/src/test/run-pass/issue-2708.rs b/src/test/run-pass/issue-2708.rs index ef0b5583b6b0c..37902b5da4868 100644 --- a/src/test/run-pass/issue-2708.rs +++ b/src/test/run-pass/issue-2708.rs @@ -10,6 +10,8 @@ #![feature(managed_boxes)] +use std::gc::GC; + struct Font { fontbuf: uint, cairo_font: uint, @@ -30,5 +32,5 @@ fn Font() -> Font { } pub fn main() { - let _f = @Font(); + let _f = box(GC) Font(); } diff --git a/src/test/run-pass/issue-2735-2.rs b/src/test/run-pass/issue-2735-2.rs index 1c9cdfa6f502a..b62905634ad09 100644 --- a/src/test/run-pass/issue-2735-2.rs +++ b/src/test/run-pass/issue-2735-2.rs @@ -11,10 +11,11 @@ #![feature(managed_boxes)] use std::cell::Cell; +use std::gc::{Gc, GC}; // This test should behave exactly like issue-2735-3 struct defer { - b: @Cell, + b: Gc>, } #[unsafe_destructor] @@ -24,14 +25,14 @@ impl Drop for defer { } } -fn defer(b: @Cell) -> defer { +fn defer(b: Gc>) -> defer { defer { b: b } } pub fn main() { - let dtor_ran = @Cell::new(false); + let dtor_ran = box(GC) 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 a54ceef0d3680..f59c143c46fda 100644 --- a/src/test/run-pass/issue-2735-3.rs +++ b/src/test/run-pass/issue-2735-3.rs @@ -11,10 +11,11 @@ #![feature(managed_boxes)] use std::cell::Cell; +use std::gc::{Gc, GC}; // This test should behave exactly like issue-2735-2 struct defer { - b: @Cell, + b: Gc>, } #[unsafe_destructor] @@ -24,14 +25,14 @@ impl Drop for defer { } } -fn defer(b: @Cell) -> defer { +fn defer(b: Gc>) -> defer { defer { b: b } } pub fn main() { - let dtor_ran = @Cell::new(false); + let dtor_ran = box(GC) 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 7f630de45dace..fffd21e9e9e58 100644 --- a/src/test/run-pass/issue-3012-2.rs +++ b/src/test/run-pass/issue-3012-2.rs @@ -15,9 +15,10 @@ 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 = @socket::socket_handle(fd); + let _sock = box(GC) socket::socket_handle(fd); } diff --git a/src/test/run-pass/issue-3121.rs b/src/test/run-pass/issue-3121.rs index 2c461119e8748..fe0b168e8fa91 100644 --- a/src/test/run-pass/issue-3121.rs +++ b/src/test/run-pass/issue-3121.rs @@ -10,11 +10,13 @@ #![feature(managed_boxes)] +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: @meal, cond: bool) { +fn foo(m: Gc, cond: bool) { match *m { to_go(_) => { } for_here(_) if cond => {} @@ -25,5 +27,5 @@ fn foo(m: @meal, cond: bool) { } pub fn main() { - foo(@for_here(hamburger), true) + foo(box(GC) for_here(hamburger), true) } diff --git a/src/test/run-pass/issue-3447.rs b/src/test/run-pass/issue-3447.rs index b34f25ce834af..b133fcad3eb3d 100644 --- a/src/test/run-pass/issue-3447.rs +++ b/src/test/run-pass/issue-3447.rs @@ -11,12 +11,13 @@ #![feature(managed_boxes)] use std::cell::RefCell; +use std::gc::{Gc, GC}; static S: &'static str = "str"; struct list { element: T, - next: Option<@RefCell>> + next: Option>>> } impl list { @@ -26,7 +27,7 @@ impl list { next: None }; - self.next = Some(@RefCell::new(newList)); + self.next = Some(box(GC) RefCell::new(newList)); } } diff --git a/src/test/run-pass/issue-3556.rs b/src/test/run-pass/issue-3556.rs index 9f3cb653eb947..2b561ec4060dd 100644 --- a/src/test/run-pass/issue-3556.rs +++ b/src/test/run-pass/issue-3556.rs @@ -12,13 +12,16 @@ extern crate debug; +use std::gc::{Gc, GC}; + enum Token { - 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), + 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), } fn check_strs(actual: &str, expected: &str) -> bool @@ -37,13 +40,13 @@ pub fn main() // assert!(check_strs(fmt!("%?", ETag(@~["foo".to_string()], @"bar".to_string())), // "ETag(@~[ ~\"foo\" ], @~\"bar\")")); - let t = Text(@"foo".to_string()); - let u = Section(@vec!("alpha".to_string()), + let t = Text(box(GC) "foo".to_string()); + let u = Section(box(GC) vec!("alpha".to_string()), true, - @vec!(t), - @"foo".to_string(), - @"foo".to_string(), @"foo".to_string(), @"foo".to_string(), - @"foo".to_string()); + 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 assert!(v.len() > 0); } diff --git a/src/test/run-pass/issue-5884.rs b/src/test/run-pass/issue-5884.rs index 8d336c6e31b19..c99fb7765fb23 100644 --- a/src/test/run-pass/issue-5884.rs +++ b/src/test/run-pass/issue-5884.rs @@ -10,6 +10,7 @@ #![feature(managed_boxes)] +use std::gc::Gc; pub struct Foo { a: int, @@ -20,7 +21,7 @@ struct Bar<'a> { b: &'a Foo, } -fn check(a: @Foo) { +fn check(a: Gc) { 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 ba8129f88822e..80727b569dea9 100644 --- a/src/test/run-pass/issue-6117.rs +++ b/src/test/run-pass/issue-6117.rs @@ -10,10 +10,12 @@ #![feature(managed_boxes)] +use std::gc::GC; + enum Either { Left(T), Right(U) } pub fn main() { - match Left(@17) { + match Left(box(GC) 17) { Right(()) => {} _ => {} } diff --git a/src/test/run-pass/issue-8898.rs b/src/test/run-pass/issue-8898.rs index 323fff76efbb7..84e9de9b924ab 100644 --- a/src/test/run-pass/issue-8898.rs +++ b/src/test/run-pass/issue-8898.rs @@ -12,6 +12,8 @@ extern crate debug; +use std::gc::GC; + fn assert_repr_eq(obj : T, expected : String) { assert_eq!(expected, format!("{:?}", obj)); } @@ -21,12 +23,12 @@ pub fn main() { let tf = [true, false]; let x = [(), ()]; let slice = x.slice(0,1); - let z = @x; + 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, "@[(), ()]".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 index 6efec00e7efd0..9f6b281810e31 100644 --- a/src/test/run-pass/issue-8983.rs +++ b/src/test/run-pass/issue-8983.rs @@ -10,10 +10,12 @@ #![feature(managed_boxes)] +use std::gc::GC; + fn main() { fn f(_: proc()) {} fn eat(_: T) {} - let x = @1; + let x = box(GC) 1; f(proc() { eat(x) }); } diff --git a/src/test/run-pass/issue-979.rs b/src/test/run-pass/issue-979.rs index a1c829c70bf50..39b81d1651918 100644 --- a/src/test/run-pass/issue-979.rs +++ b/src/test/run-pass/issue-979.rs @@ -11,9 +11,10 @@ #![feature(managed_boxes)] use std::cell::Cell; +use std::gc::{GC, Gc}; struct r { - b: @Cell, + b: Gc>, } #[unsafe_destructor] @@ -23,14 +24,14 @@ impl Drop for r { } } -fn r(b: @Cell) -> r { +fn r(b: Gc>) -> r { r { b: b } } pub fn main() { - let b = @Cell::new(0); + let b = box(GC) 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 index bc53ba7e48df9..ea17c6cd020b7 100644 --- a/src/test/run-pass/issue-980.rs +++ b/src/test/run-pass/issue-980.rs @@ -11,10 +11,11 @@ #![feature(managed_boxes)] use std::cell::RefCell; +use std::gc::{Gc, GC}; enum maybe_pointy { no_pointy, - yes_pointy(@RefCell), + yes_pointy(Gc>), } struct Pointy { @@ -22,7 +23,7 @@ struct Pointy { } pub fn main() { - let m = @RefCell::new(Pointy { x : no_pointy }); + 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 index c8d557fd35e8b..3cdaf850d80fd 100644 --- a/src/test/run-pass/leak-box-as-tydesc.rs +++ b/src/test/run-pass/leak-box-as-tydesc.rs @@ -10,6 +10,8 @@ #![feature(managed_boxes)] +use std::gc::{Gc, GC}; + fn leaky(_t: T) { } -pub fn main() { let x = @10; leaky::<@int>(x); } +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 index 6cd6bb38d3f75..18ca6584f9edb 100644 --- a/src/test/run-pass/leak-tag-copy.rs +++ b/src/test/run-pass/leak-tag-copy.rs @@ -12,6 +12,8 @@ #![allow(dead_assignment)] #![allow(unused_variable)] -enum t { a, b(@int), } +use std::gc::{Gc, GC}; -pub fn main() { let mut x = b(@10); x = a; } +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 6803c31f0973b..c42f610bcd1c3 100644 --- a/src/test/run-pass/list.rs +++ b/src/test/run-pass/list.rs @@ -10,6 +10,8 @@ #![feature(managed_boxes)] -enum list { cons(int, @list), nil, } +use std::gc::{Gc, GC}; -pub fn main() { cons(10, @cons(11, @cons(12, @nil))); } +enum list { 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/mlist.rs b/src/test/run-pass/mlist.rs index 27073aa23ffb9..be16c68770a49 100644 --- a/src/test/run-pass/mlist.rs +++ b/src/test/run-pass/mlist.rs @@ -10,6 +10,8 @@ #![feature(managed_boxes)] -enum mlist { cons(int, @mlist), nil, } +use std::gc::{Gc, GC}; -pub fn main() { cons(10, @cons(11, @cons(12, @nil))); } +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 index 084f979bf9689..19238193a1a54 100644 --- a/src/test/run-pass/move-1.rs +++ b/src/test/run-pass/move-1.rs @@ -10,18 +10,20 @@ #![feature(managed_boxes)] +use std::gc::{Gc, GC}; + struct Triple { x: int, y: int, z: int } -fn test(x: bool, foo: @Triple) -> int { +fn test(x: bool, foo: Gc) -> int { let bar = foo; - let mut y: @Triple; + let mut y: Gc; y = bar; - if x { y = bar; } else { y = @Triple{x: 4, y: 5, z: 6}; } + if x { y = bar; } else { y = box(GC) Triple{x: 4, y: 5, z: 6}; } return y.y; } pub fn main() { - let x = @Triple {x: 1, y: 2, z: 3}; + 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); diff --git a/src/test/run-pass/move-2.rs b/src/test/run-pass/move-2.rs index 41642920bdc7e..d553141882607 100644 --- a/src/test/run-pass/move-2.rs +++ b/src/test/run-pass/move-2.rs @@ -10,6 +10,8 @@ #![feature(managed_boxes)] +use std::gc::GC; + struct X { x: int, y: int, z: int } -pub fn main() { let x = @X {x: 1, y: 2, z: 3}; let y = x; assert!((y.y == 2)); } +pub fn main() { let x = box(GC) 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 index cc5745d2750ff..0ddc8371dab6f 100644 --- a/src/test/run-pass/move-3.rs +++ b/src/test/run-pass/move-3.rs @@ -10,17 +10,19 @@ #![feature(managed_boxes)] +use std::gc::{Gc, GC}; + struct Triple { x: int, y: int, z: int } -fn test(x: bool, foo: @Triple) -> int { +fn test(x: bool, foo: Gc) -> int { let bar = foo; - let mut y: @Triple; - if x { y = bar; } else { y = @Triple{x: 4, y: 5, z: 6}; } + 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 = @Triple{x: 1, y: 2, z: 3}; + let x = box(GC) Triple{x: 1, y: 2, z: 3}; for _i in range(0u, 10000u) { assert_eq!(test(true, x), 2); } diff --git a/src/test/run-pass/move-4.rs b/src/test/run-pass/move-4.rs index 2195c5855bed3..291996a63e330 100644 --- a/src/test/run-pass/move-4.rs +++ b/src/test/run-pass/move-4.rs @@ -10,9 +10,11 @@ #![feature(managed_boxes)] +use std::gc::{GC, Gc}; + struct Triple { a: int, b: int, c: int } -fn test(foo: @Triple) -> @Triple { +fn test(foo: Gc) -> Gc { let foo = foo; let bar = foo; let baz = bar; @@ -21,7 +23,7 @@ fn test(foo: @Triple) -> @Triple { } pub fn main() { - let x = @Triple{a: 1, b: 2, c: 3}; + let x = box(GC) 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 c7dfb28032668..1977830733b9c 100644 --- a/src/test/run-pass/move-arg-2.rs +++ b/src/test/run-pass/move-arg-2.rs @@ -10,14 +10,15 @@ #![feature(managed_boxes)] +use std::gc::{Gc, GC}; -fn test(foo: @Vec ) { assert!((*foo.get(0) == 10)); } +fn test(foo: Gc>) { assert!((*foo.get(0) == 10)); } pub fn main() { - let x = @vec!(10); + let x = box(GC) vec!(10); // Test forgetting a local by move-in test(x); // Test forgetting a temporary by move-in. - test(@vec!(10)); + test(box(GC) vec!(10)); } diff --git a/src/test/run-pass/mutable-vec-drop.rs b/src/test/run-pass/mutable-vec-drop.rs index c693cf9c48be9..4c39be0ed1927 100644 --- a/src/test/run-pass/mutable-vec-drop.rs +++ b/src/test/run-pass/mutable-vec-drop.rs @@ -11,11 +11,14 @@ #![feature(managed_boxes)] #![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<@Pair> = - vec!(@Pair{a: 1, b: 2}, @Pair{a: 3, b: 4}, @Pair{a: 5, b: 6}); + 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 e0c3146717af3..41cf4c64b26cd 100644 --- a/src/test/run-pass/mutual-recursion-group.rs +++ b/src/test/run-pass/mutual-recursion-group.rs @@ -10,12 +10,14 @@ #![feature(managed_boxes)] +use std::gc::Gc; + enum colour { red, green, blue, } -enum tree { children(@list), leaf(colour), } +enum tree { children(Gc), leaf(colour), } -enum list { cons(@tree, @list), nil, } +enum list { cons(Gc, Gc), nil, } -enum small_list { kons(int, @small_list), neel, } +enum small_list { kons(int, Gc), 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 cab3f36a9f4fd..0150120e1dbca 100644 --- a/src/test/run-pass/new-box-syntax.rs +++ b/src/test/run-pass/new-box-syntax.rs @@ -13,7 +13,7 @@ // Tests that the new `box` syntax works with unique pointers and GC pointers. -use std::gc::Gc; +use std::gc::{Gc, GC}; use std::owned::{Box, HEAP}; struct Structure { diff --git a/src/test/run-pass/newtype-struct-drop-run.rs b/src/test/run-pass/newtype-struct-drop-run.rs index fc008a625d8de..3821efcb1bcf7 100644 --- a/src/test/run-pass/newtype-struct-drop-run.rs +++ b/src/test/run-pass/newtype-struct-drop-run.rs @@ -13,8 +13,9 @@ // Make sure the destructor is run for newtype structs. use std::cell::Cell; +use std::gc::{Gc, GC}; -struct Foo(@Cell); +struct Foo(Gc>); #[unsafe_destructor] impl Drop for Foo { @@ -25,7 +26,7 @@ impl Drop for Foo { } pub fn main() { - let y = @Cell::new(32); + let y = box(GC) 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 0e185c3a33599..8b26ece176d4d 100644 --- a/src/test/run-pass/nullable-pointer-iotareduction.rs +++ b/src/test/run-pass/nullable-pointer-iotareduction.rs @@ -11,6 +11,7 @@ #![feature(macro_rules, managed_boxes)] 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 @@ -75,7 +76,7 @@ macro_rules! check_type { pub fn main() { check_type!(&17: &int); check_type!(box 18: Box); - check_type!(@19: @int); + 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 2309984a1f11c..8a54f22585ff8 100644 --- a/src/test/run-pass/nullable-pointer-size.rs +++ b/src/test/run-pass/nullable-pointer-size.rs @@ -11,6 +11,7 @@ #![feature(macro_rules, managed_boxes)] use std::mem; +use std::gc::Gc; enum E { Thing(int, T), Nothing((), ((), ()), [i8, ..0]) } struct S(int, T); @@ -39,6 +40,6 @@ macro_rules! check_type { pub fn main() { check_type!(&'static int); check_type!(Box); - check_type!(@int); + 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 index 7752aed7236a6..be1b135ddc966 100644 --- a/src/test/run-pass/objects-owned-object-borrowed-method-header.rs +++ b/src/test/run-pass/objects-owned-object-borrowed-method-header.rs @@ -10,6 +10,7 @@ #![feature(managed_boxes)] +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 @@ -20,7 +21,7 @@ trait FooTrait { } struct BarStruct { - x: @uint + x: Gc } impl FooTrait for BarStruct { @@ -31,9 +32,9 @@ impl FooTrait for BarStruct { pub fn main() { let foos: Vec> = vec!( - box BarStruct{ x: @0 } as Box, - box BarStruct{ x: @1 } as Box, - box BarStruct{ x: @2 } as Box + 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()) { diff --git a/src/test/run-pass/option-unwrap.rs b/src/test/run-pass/option-unwrap.rs index c7acb0b591560..eea5296d7e487 100644 --- a/src/test/run-pass/option-unwrap.rs +++ b/src/test/run-pass/option-unwrap.rs @@ -11,9 +11,10 @@ #![feature(managed_boxes)] use std::cell::Cell; +use std::gc::{GC, Gc}; struct dtor { - x: @Cell, + x: Gc>, } #[unsafe_destructor] @@ -32,7 +33,7 @@ fn unwrap(o: Option) -> T { } pub fn main() { - let x = @Cell::new(1); + let x = box(GC) 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 47bb905cac2b7..f0728d0bd22c7 100644 --- a/src/test/run-pass/output-slot-variants.rs +++ b/src/test/run-pass/output-slot-variants.rs @@ -12,28 +12,30 @@ #![allow(dead_assignment)] #![allow(unused_variable)] +use std::gc::{Gc, GC}; + struct A { a: int, b: int } -struct Abox { a: @int, b: @int } +struct Abox { a: Gc, b: Gc } fn ret_int_i() -> int { return 10; } -fn ret_ext_i() -> @int { return @10; } +fn ret_ext_i() -> Gc { return box(GC) 10; } fn ret_int_rec() -> A { return A {a: 10, b: 10}; } -fn ret_ext_rec() -> @A { return @A {a: 10, b: 10}; } +fn ret_ext_rec() -> Gc { return box(GC) A {a: 10, b: 10}; } -fn ret_ext_mem() -> Abox { return Abox {a: @10, b: @10}; } +fn ret_ext_mem() -> Abox { return Abox {a: box(GC) 10, b: box(GC) 10}; } -fn ret_ext_ext_mem() -> @Abox { return @Abox{a: @10, b: @10}; } +fn ret_ext_ext_mem() -> Gc { box(GC) Abox{a: box(GC) 10, b: box(GC) 10} } pub fn main() { let mut int_i: int; - let mut ext_i: @int; + let mut ext_i: Gc; let mut int_rec: A; - let mut ext_rec: @A; + let mut ext_rec: Gc; let mut ext_mem: Abox; - let mut ext_ext_mem: @Abox; + let mut ext_ext_mem: Gc; 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 1781f162bc498..aedead36ed191 100644 --- a/src/test/run-pass/packed-struct-size.rs +++ b/src/test/run-pass/packed-struct-size.rs @@ -11,6 +11,7 @@ #![feature(managed_boxes)] use std::mem; +use std::gc::Gc; #[packed] struct S4 { @@ -48,7 +49,7 @@ struct S7_Option { a: f32, b: u8, c: u16, - d: Option<@f64> + d: Option> } // Placing packed structs in statics should work @@ -62,5 +63,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 9036df0bbd1e9..6e53774d68d4d 100644 --- a/src/test/run-pass/packed-tuple-struct-size.rs +++ b/src/test/run-pass/packed-tuple-struct-size.rs @@ -10,6 +10,7 @@ #![feature(managed_boxes)] +use std::gc::Gc; use std::mem; #[packed] @@ -30,7 +31,7 @@ enum Foo { struct S3_Foo(u8, u16, Foo); #[packed] -struct S7_Option(f32, u8, u16, Option<@f64>); +struct S7_Option(f32, u8, u16, Option>); pub fn main() { assert_eq!(mem::size_of::(), 4); @@ -43,5 +44,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 index 1d48cd3226d00..c7c088d59d4cf 100644 --- a/src/test/run-pass/pass-by-copy.rs +++ b/src/test/run-pass/pass-by-copy.rs @@ -12,14 +12,16 @@ extern crate debug; +use std::gc::{GC, Gc}; + fn magic(x: A) { println!("{:?}", x); } -fn magic2(x: @int) { println!("{:?}", x); } +fn magic2(x: Gc) { println!("{:?}", x); } -struct A { a: @int } +struct A { a: Gc } pub fn main() { - let a = A {a: @10}; - let b = @10; - magic(a); magic(A {a: @20}); - magic2(b); magic2(@20); + 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 eab5ba6108367..0d9f05b9e2663 100644 --- a/src/test/run-pass/rcvr-borrowed-to-region.rs +++ b/src/test/run-pass/rcvr-borrowed-to-region.rs @@ -10,6 +10,8 @@ #![feature(managed_boxes)] +use std::gc::GC; + trait get { fn get(self) -> int; } @@ -24,11 +26,11 @@ impl<'a> get for &'a int { } pub fn main() { - let x = @6; + let x = box(GC) 6; let y = x.get(); assert_eq!(y, 6); - let x = @6; + let x = box(GC) 6; let y = x.get(); println!("y={}", y); assert_eq!(y, 6); diff --git a/src/test/run-pass/regions-borrow-at.rs b/src/test/run-pass/regions-borrow-at.rs index 5447163a597da..c6dfbabd448db 100644 --- a/src/test/run-pass/regions-borrow-at.rs +++ b/src/test/run-pass/regions-borrow-at.rs @@ -10,12 +10,14 @@ #![feature(managed_boxes)] +use std::gc::GC; + fn foo(x: &uint) -> uint { *x } pub fn main() { - let p = @22u; + let p = box(GC) 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 2377a60153b16..695a1b110da4e 100644 --- a/src/test/run-pass/regions-escape-into-other-fn.rs +++ b/src/test/run-pass/regions-escape-into-other-fn.rs @@ -10,10 +10,12 @@ #![feature(managed_boxes)] +use std::gc::GC; + fn foo<'r>(x: &'r uint) -> &'r uint { x } fn bar(x: &uint) -> uint { *x } pub fn main() { - let p = @3u; + let p = box(GC) 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 a08b0cd998b17..ee01a3837dcdb 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,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(managed_boxes)] +use std::gc::GC; fn borrow<'r, T>(x: &'r T) -> &'r T {x} pub fn main() { - let x = @3; + let x = box(GC) 3; 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 adfad21d530b2..c757762245325 100644 --- a/src/test/run-pass/regions-infer-borrow-scope.rs +++ b/src/test/run-pass/regions-infer-borrow-scope.rs @@ -10,6 +10,8 @@ #![feature(managed_boxes)] +use std::gc::GC; + struct Point {x: int, y: int} fn x_coord<'r>(p: &'r Point) -> &'r int { @@ -17,7 +19,7 @@ fn x_coord<'r>(p: &'r Point) -> &'r int { } pub fn main() { - let p = @Point {x: 3, y: 4}; + let p = box(GC) 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 9b0837594cfde..7f266ec912abb 100644 --- a/src/test/run-pass/resource-assign-is-not-copy.rs +++ b/src/test/run-pass/resource-assign-is-not-copy.rs @@ -13,9 +13,10 @@ extern crate debug; use std::cell::Cell; +use std::gc::{Gc, GC}; struct r { - i: @Cell, + i: Gc>, } #[unsafe_destructor] @@ -25,14 +26,14 @@ impl Drop for r { } } -fn r(i: @Cell) -> r { +fn r(i: Gc>) -> r { r { i: i } } pub fn main() { - let i = @Cell::new(0); + let i = box(GC) Cell::new(0); // Even though these look like copies, they are guaranteed not to be { let a = r(i); diff --git a/src/test/run-pass/resource-destruct.rs b/src/test/run-pass/resource-destruct.rs index 337908e8a8464..85750899259c2 100644 --- a/src/test/run-pass/resource-destruct.rs +++ b/src/test/run-pass/resource-destruct.rs @@ -11,9 +11,10 @@ #![feature(managed_boxes)] use std::cell::Cell; +use std::gc::{GC, Gc}; struct shrinky_pointer { - i: @@Cell, + i: Gc>>, } #[unsafe_destructor] @@ -27,14 +28,14 @@ impl shrinky_pointer { pub fn look_at(&self) -> int { return self.i.get(); } } -fn shrinky_pointer(i: @@Cell) -> shrinky_pointer { +fn shrinky_pointer(i: Gc>>) -> shrinky_pointer { shrinky_pointer { i: i } } pub fn main() { - let my_total = @@Cell::new(10); + let my_total = box(GC) box(GC) 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 740fe952c45e0..88edefdfe29a0 100644 --- a/src/test/run-pass/resource-in-struct.rs +++ b/src/test/run-pass/resource-in-struct.rs @@ -14,8 +14,9 @@ // variant use std::cell::Cell; +use std::gc::{Gc, GC}; -type closable = @Cell; +type closable = Gc>; struct close_res { i: closable, @@ -40,7 +41,7 @@ enum option { none, some(T), } fn sink(_res: option) { } pub fn main() { - let c = @Cell::new(true); + let c = box(GC) 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 0f1882167451e..b60f09d698fa1 100644 --- a/src/test/run-pass/shape_intrinsic_tag_then_rec.rs +++ b/src/test/run-pass/shape_intrinsic_tag_then_rec.rs @@ -17,12 +17,13 @@ extern crate debug; // interior record which is then itself interior to // something else, shape calculations were off. +use std::gc::{Gc, GC}; #[deriving(Clone)] enum opt_span { //hack (as opposed to option), to make `span` compile os_none, - os_some(@Span), + os_some(Gc), } #[deriving(Clone)] @@ -44,7 +45,7 @@ type ty_ = uint; struct Path_ { global: bool, idents: Vec , - types: Vec<@ty>, + types: Vec>, } type path = Spanned; @@ -58,7 +59,7 @@ struct X { pub fn main() { let sp: Span = Span {lo: 57451u, hi: 57542u, expanded_from: os_none}; - let t: @ty = @Spanned { data: 3u, span: sp }; + let t: Gc = box(GC) Spanned { data: 3u, span: sp }; let p_: Path_ = Path_ { global: true, idents: vec!("hi".to_string()), diff --git a/src/test/run-pass/terminate-in-initializer.rs b/src/test/run-pass/terminate-in-initializer.rs index 62a8bc075f715..391f0e20fccd9 100644 --- a/src/test/run-pass/terminate-in-initializer.rs +++ b/src/test/run-pass/terminate-in-initializer.rs @@ -14,21 +14,22 @@ // Don't try to clean up uninitialized locals use std::task; +use std::gc::{Gc}; -fn test_break() { loop { let _x: @int = break; } } +fn test_break() { loop { let _x: Gc = break; } } -fn test_cont() { let mut i = 0; while i < 1 { i += 1; let _x: @int = continue; } } +fn test_cont() { let mut i = 0; while i < 1 { i += 1; let _x: Gc = continue; } } -fn test_ret() { let _x: @int = return; } +fn test_ret() { let _x: Gc = return; } fn test_fail() { - fn f() { let _x: @int = fail!(); } + fn f() { let _x: Gc = fail!(); } task::try(proc() f() ); } fn test_fail_indirect() { fn f() -> ! { fail!(); } - fn g() { let _x: @int = f(); } + fn g() { let _x: Gc = f(); } task::try(proc() g() ); } diff --git a/src/test/run-pass/trait-cast.rs b/src/test/run-pass/trait-cast.rs index 0f99998b7a6ed..18209be0dece3 100644 --- a/src/test/run-pass/trait-cast.rs +++ b/src/test/run-pass/trait-cast.rs @@ -15,8 +15,9 @@ // Test cyclic detector when using trait instances. use std::cell::RefCell; +use std::gc::{GC, Gc}; -struct Tree(@RefCell); +struct Tree(Gc>); struct TreeR { left: Option, right: Option, @@ -55,12 +56,12 @@ impl to_str for Tree { fn foo(x: T) -> String { x.to_str_() } pub fn main() { - let t1 = Tree(@RefCell::new(TreeR{left: None, - right: None, - val: box 1 as Box})); - let t2 = Tree(@RefCell::new(TreeR{left: Some(t1), - right: Some(t1), - val: box 2 as Box})); + let t1 = Tree(box(GC) RefCell::new(TreeR{left: None, + right: None, + val: box 1 as Box})); + let t2 = Tree(box(GC) RefCell::new(TreeR{left: Some(t1), + right: Some(t1), + val: box 2 as Box})); let expected = "[2, some([1, none, none]), some([1, none, none])]".to_string(); assert!(t2.to_str_() == expected); diff --git a/src/test/run-pass/type-param-constraints.rs b/src/test/run-pass/type-param-constraints.rs index 0fcf9b92ce04c..b87517940c266 100644 --- a/src/test/run-pass/type-param-constraints.rs +++ b/src/test/run-pass/type-param-constraints.rs @@ -10,6 +10,7 @@ #![feature(managed_boxes)] +use std::gc::GC; fn p_foo(_pinned: T) { } fn s_foo(_shared: T) { } @@ -31,15 +32,15 @@ fn r(i:int) -> r { pub fn main() { p_foo(r(10)); - p_foo(@r(10)); + p_foo(box(GC) r(10)); p_foo(box r(10)); - p_foo(@10); + p_foo(box(GC) 10); p_foo(box 10); p_foo(10); - s_foo(@r(10)); - s_foo(@10); + s_foo(box(GC) r(10)); + s_foo(box(GC) 10); s_foo(box 10); s_foo(10); diff --git a/src/test/run-pass/typeclasses-eq-example-static.rs b/src/test/run-pass/typeclasses-eq-example-static.rs index 13d8ea4002ce4..ef79412c75e66 100644 --- a/src/test/run-pass/typeclasses-eq-example-static.rs +++ b/src/test/run-pass/typeclasses-eq-example-static.rs @@ -13,6 +13,8 @@ // 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; } @@ -33,7 +35,7 @@ impl Equal for Color { enum ColorTree { leaf(Color), - branch(@ColorTree, @ColorTree) + branch(Gc, Gc) } impl Equal for ColorTree { @@ -57,11 +59,11 @@ pub fn main() { assert!(Equal::isEq(leaf(cyan), leaf(cyan))); assert!(!Equal::isEq(leaf(cyan), leaf(yellow))); - assert!(Equal::isEq(branch(@leaf(magenta), @leaf(cyan)), - branch(@leaf(magenta), @leaf(cyan)))); + 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(@leaf(magenta), @leaf(cyan)), - branch(@leaf(magenta), @leaf(magenta)))); + assert!(!Equal::isEq(branch(box(GC) leaf(magenta), box(GC) leaf(cyan)), + branch(box(GC) leaf(magenta), box(GC) 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 95bd093fcec17..e063f9ecb74d6 100644 --- a/src/test/run-pass/typeclasses-eq-example.rs +++ b/src/test/run-pass/typeclasses-eq-example.rs @@ -12,6 +12,8 @@ // Example from lkuper's intern talk, August 2012. +use std::gc::{GC, Gc}; + trait Equal { fn isEq(&self, a: Self) -> bool; } @@ -32,7 +34,7 @@ impl Equal for Color { enum ColorTree { leaf(Color), - branch(@ColorTree, @ColorTree) + branch(Gc, Gc) } impl Equal for ColorTree { @@ -56,11 +58,11 @@ pub fn main() { assert!(leaf(cyan).isEq(leaf(cyan))); assert!(!leaf(cyan).isEq(leaf(yellow))); - assert!(branch(@leaf(magenta), @leaf(cyan)) - .isEq(branch(@leaf(magenta), @leaf(cyan)))); + assert!(branch(box(GC) leaf(magenta), box(GC) leaf(cyan)) + .isEq(branch(box(GC) leaf(magenta), box(GC) leaf(cyan)))); - assert!(!branch(@leaf(magenta), @leaf(cyan)) - .isEq(branch(@leaf(magenta), @leaf(magenta)))); + assert!(!branch(box(GC) leaf(magenta), box(GC) leaf(cyan)) + .isEq(branch(box(GC) leaf(magenta), box(GC) 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 index f25dfcb94c591..77a8009c97593 100644 --- a/src/test/run-pass/uniq-cc-generic.rs +++ b/src/test/run-pass/uniq-cc-generic.rs @@ -13,10 +13,11 @@ #![feature(managed_boxes)] use std::cell::RefCell; +use std::gc::{Gc, GC}; enum maybe_pointy { none, - p(@RefCell), + p(Gc>), } struct Pointy { @@ -28,8 +29,8 @@ fn make_uniq_closure(a: A) -> proc():Send -> uint { proc() { &a as *A as uint } } -fn empty_pointy() -> @RefCell { - return @RefCell::new(Pointy { +fn empty_pointy() -> Gc> { + return box(GC) RefCell::new(Pointy { a : none, d : make_uniq_closure("hi".to_string()) }) diff --git a/src/test/run-pass/uniq-cc.rs b/src/test/run-pass/uniq-cc.rs index 06e9771aae4fa..ed5e1a5546af0 100644 --- a/src/test/run-pass/uniq-cc.rs +++ b/src/test/run-pass/uniq-cc.rs @@ -11,10 +11,11 @@ #![feature(managed_boxes)] use std::cell::RefCell; +use std::gc::{Gc, GC}; enum maybe_pointy { none, - p(@RefCell), + p(Gc>), } struct Pointy { @@ -23,8 +24,8 @@ struct Pointy { d : proc():Send->(), } -fn empty_pointy() -> @RefCell { - return @RefCell::new(Pointy { +fn empty_pointy() -> Gc> { + return box(GC) RefCell::new(Pointy { a : none, c : box 22, d : proc() {}, diff --git a/src/test/run-pass/unique-assign-generic.rs b/src/test/run-pass/unique-assign-generic.rs index 94e3ea565d6b2..da77921e5c37b 100644 --- a/src/test/run-pass/unique-assign-generic.rs +++ b/src/test/run-pass/unique-assign-generic.rs @@ -10,6 +10,8 @@ #![feature(managed_boxes)] +use std::gc::GC; + fn f(t: T) -> T { let t1 = t; t1 @@ -18,6 +20,6 @@ fn f(t: T) -> T { pub fn main() { let t = f(box 100); assert_eq!(t, box 100); - let t = f(box @vec!(100)); - assert_eq!(t, box @vec!(100)); + let t = f(box box(GC) vec!(100)); + assert_eq!(t, box box(GC) vec!(100)); } diff --git a/src/test/run-pass/unwind-box.rs b/src/test/run-pass/unwind-box.rs index 58d389e9133c2..f06791ff2c7b4 100644 --- a/src/test/run-pass/unwind-box.rs +++ b/src/test/run-pass/unwind-box.rs @@ -11,9 +11,10 @@ #![feature(managed_boxes)] use std::task; +use std::gc::GC; fn f() { - let _a = @0; + let _a = box(GC) 0; fail!(); } diff --git a/src/test/run-pass/unwind-resource2.rs b/src/test/run-pass/unwind-resource2.rs index 85c4975b6712f..b1669dea7b216 100644 --- a/src/test/run-pass/unwind-resource2.rs +++ b/src/test/run-pass/unwind-resource2.rs @@ -11,9 +11,10 @@ #![feature(managed_boxes)] use std::task; +use std::gc::{Gc, GC}; struct complainer { - c: @int, + c: Gc, } #[unsafe_destructor] @@ -21,14 +22,14 @@ impl Drop for complainer { fn drop(&mut self) {} } -fn complainer(c: @int) -> complainer { +fn complainer(c: Gc) -> complainer { complainer { c: c } } fn f() { - let _c = complainer(@0); + let _c = complainer(box(GC) 0); fail!(); } diff --git a/src/test/run-pass/vec-drop.rs b/src/test/run-pass/vec-drop.rs index 7638b7f6a3ac1..e2901a84b8b9b 100644 --- a/src/test/run-pass/vec-drop.rs +++ b/src/test/run-pass/vec-drop.rs @@ -10,12 +10,15 @@ #![feature(managed_boxes)] +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<@Pair> = - vec!(@Pair{x: 1, y: 2}, @Pair{x: 3, y: 4}, @Pair{x: 5, y: 6}); + 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 a27498aad7408..3c0a9abec144a 100644 --- a/src/test/run-pass/vec-slice-drop.rs +++ b/src/test/run-pass/vec-slice-drop.rs @@ -11,10 +11,11 @@ #![feature(managed_boxes)] use std::cell::Cell; +use std::gc::{Gc, GC}; // Make sure that destructors get run on slice literals struct foo { - x: @Cell, + x: Gc>, } #[unsafe_destructor] @@ -24,14 +25,14 @@ impl Drop for foo { } } -fn foo(x: @Cell) -> foo { +fn foo(x: Gc>) -> foo { foo { x: x } } pub fn main() { - let x = @Cell::new(0); + let x = box(GC) Cell::new(0); { let l = &[foo(x)]; assert_eq!(l[0].x.get(), 0); diff --git a/src/test/run-pass/vector-no-ann-2.rs b/src/test/run-pass/vector-no-ann-2.rs index 3367905731030..c2280cd2c6aae 100644 --- a/src/test/run-pass/vector-no-ann-2.rs +++ b/src/test/run-pass/vector-no-ann-2.rs @@ -11,4 +11,4 @@ #![feature(managed_boxes)] -pub fn main() { let _quux: @Vec = @Vec::new(); } +pub fn main() { let _quux: Box> = box Vec::new(); } diff --git a/src/test/run-pass/weird-exprs.rs b/src/test/run-pass/weird-exprs.rs index 3a2b1f7009d9f..1eb34f9df2551 100644 --- a/src/test/run-pass/weird-exprs.rs +++ b/src/test/run-pass/weird-exprs.rs @@ -12,6 +12,7 @@ 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 +24,10 @@ fn funny() { } fn what() { - fn the(x: @Cell) { + fn the(x: Gc>) { return while !x.get() { x.set(true); }; } - let i = @Cell::new(false); + let i = box(GC) Cell::new(false); let dont = {||the(i)}; dont(); assert!((i.get()));