Gate literal box expressions in addition to types

Closes #10920
This commit is contained in:
Alex Crichton 2013-12-11 23:17:54 -08:00
parent 1b12dca7f9
commit 0f6537fed4
90 changed files with 187 additions and 16 deletions

View File

@ -77,6 +77,14 @@ impl Context {
} }
} }
fn gate_box(&self, span: Span) {
self.gate_feature("managed_boxes", span,
"The managed box syntax is being replaced by the \
`std::gc::Gc` and `std::rc::Rc` types. Equivalent \
functionality to managed trait objects will be \
implemented but is currently missing.");
}
fn has_feature(&self, feature: &str) -> bool { fn has_feature(&self, feature: &str) -> bool {
self.features.iter().any(|n| n.as_slice() == feature) self.features.iter().any(|n| n.as_slice() == feature)
} }
@ -172,17 +180,24 @@ impl Visitor<()> for Context {
experimental and likely to be removed"); experimental and likely to be removed");
}, },
ast::ty_box(_) => { ast::ty_box(_) => { self.gate_box(t.span); }
self.gate_feature("managed_boxes", t.span,
"The managed box syntax is being replaced by the `std::gc::Gc` \
and `std::rc::Rc` types. Equivalent functionality to managed \
trait objects will be implemented but is currently missing.");
}
_ => {} _ => {}
} }
visit::walk_ty(self, t, ()); visit::walk_ty(self, t, ());
} }
fn visit_expr(&mut self, e: @ast::Expr, _: ()) {
match e.node {
ast::ExprUnary(_, ast::UnBox(..), _) |
ast::ExprVstore(_, ast::ExprVstoreBox) |
ast::ExprVstore(_, ast::ExprVstoreMutBox) => {
self.gate_box(e.span);
}
_ => {}
}
visit::walk_expr(self, e, ());
}
} }
pub fn check_crate(sess: Session, crate: &ast::Crate) { pub fn check_crate(sess: Session, crate: &ast::Crate) {

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
fn main() { fn main() {
// Testing that method lookup does not automatically borrow // Testing that method lookup does not automatically borrow

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
struct Point { struct Point {
x: int, x: int,
y: int, y: int,

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
struct point { x: int, y: int } struct point { x: int, y: int }
trait methods { trait methods {

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
fn main() { fn main() {
let v = @mut [ 1, 2, 3 ]; let v = @mut [ 1, 2, 3 ];
for _x in v.iter() { for _x in v.iter() {

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
mod my_mod { mod my_mod {
pub struct MyStruct { pub struct MyStruct {
priv priv_field: int priv priv_field: int

View File

@ -1,6 +1,8 @@
// Tests that references to move-by-default values trigger moves when // Tests that references to move-by-default values trigger moves when
// they occur as part of various kinds of expressions. // they occur as part of various kinds of expressions.
#[feature(managed_boxes)];
struct Foo<A> { f: A } struct Foo<A> { f: A }
fn guard(_s: ~str) -> bool {fail!()} fn guard(_s: ~str) -> bool {fail!()}
fn touch<A>(_a: &A) {} fn touch<A>(_a: &A) {}

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
enum t { a, b, } enum t { a, b, }
fn main() { fn main() {

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
fn main() { fn main() {
let f; //~ ERROR cyclic type of infinite size let f; //~ ERROR cyclic type of infinite size
f = @f; f = @f;

View File

@ -1,3 +1,5 @@
#[feature(managed_boxes)];
fn f<T:'static>(_: T) {} fn f<T:'static>(_: T) {}
fn main() { fn main() {

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
fn f<T:Send>(_i: T) { fn f<T:Send>(_i: T) {
} }

View File

@ -8,6 +8,8 @@
// //
// for a detailed explanation of what is going on here. // for a detailed explanation of what is going on here.
#[feature(managed_boxes)];
fn main() { fn main() {
let a = @mut [3i]; let a = @mut [3i];
let b = @mut [a]; let b = @mut [a];

View File

@ -3,6 +3,8 @@
// Test that write guards trigger when there is a write to a field // Test that write guards trigger when there is a write to a field
// of a frozen structure. // of a frozen structure.
#[feature(managed_boxes)];
struct S { struct S {
x: int x: int
} }

View File

@ -3,6 +3,8 @@
// Test that write guards trigger when there is a write to a directly // Test that write guards trigger when there is a write to a directly
// frozen @mut box. // frozen @mut box.
#[feature(managed_boxes)];
fn main() { fn main() {
let x = @mut 3; let x = @mut 3;
let _y: &mut int = x; let _y: &mut int = x;

View File

@ -3,6 +3,8 @@
// Test that write guards trigger when there is a coercion to // Test that write guards trigger when there is a coercion to
// a slice on the receiver of a method. // a slice on the receiver of a method.
#[feature(managed_boxes)];
trait MyMutSlice { trait MyMutSlice {
fn my_mut_slice(self) -> Self; fn my_mut_slice(self) -> Self;
} }

View File

@ -2,6 +2,8 @@
// Test that write guards trigger when arguments are coerced to slices. // Test that write guards trigger when arguments are coerced to slices.
#[feature(managed_boxes)];
fn add(x:&mut [int], y:&[int]) fn add(x:&mut [int], y:&[int])
{ {
x[0] = x[0] + y[0]; x[0] = x[0] + y[0];

View File

@ -3,6 +3,8 @@
// Test that write guards trigger when we are indexing into // Test that write guards trigger when we are indexing into
// an @mut vector. // an @mut vector.
#[feature(managed_boxes)];
fn add(x:&mut int, y:&int) fn add(x:&mut int, y:&int)
{ {
*x = *x + *y; *x = *x + *y;

View File

@ -3,6 +3,8 @@
// Test that arguments trigger when there are *two mutable* borrows // Test that arguments trigger when there are *two mutable* borrows
// of indices. // of indices.
#[feature(managed_boxes)];
fn add(x:&mut int, y:&mut int) fn add(x:&mut int, y:&mut int)
{ {
*x = *x + *y; *x = *x + *y;

View File

@ -10,6 +10,8 @@
// error-pattern:fail // error-pattern:fail
#[feature(managed_boxes)];
fn main() { fn main() {
let _a = @0; let _a = @0;
assert!(false); assert!(false);

View File

@ -10,6 +10,8 @@
// error-pattern:fail // error-pattern:fail
#[feature(managed_boxes)];
use std::cast; use std::cast;
fn failfn() { fn failfn() {

View File

@ -10,6 +10,8 @@
// error-pattern:fail // error-pattern:fail
#[feature(managed_boxes)];
fn failfn() { fn failfn() {
fail!(); fail!();
} }

View File

@ -10,6 +10,8 @@
// error-pattern:fail // error-pattern:fail
#[feature(managed_boxes)];
fn failfn() { fn failfn() {
fail!(); fail!();
} }

View File

@ -10,6 +10,8 @@
// error-pattern:fail // error-pattern:fail
#[feature(managed_boxes)];
fn failfn() { fn failfn() {
fail!(); fail!();
} }

View File

@ -10,6 +10,8 @@
// error-pattern:fail // error-pattern:fail
#[feature(managed_boxes)];
fn failfn() { fn failfn() {
fail!(); fail!();
} }

View File

@ -10,6 +10,8 @@
// error-pattern:fail // error-pattern:fail
#[feature(managed_boxes)];
fn failfn() { fn failfn() {
fail!(); fail!();
} }

View File

@ -10,6 +10,8 @@
// error-pattern:fail // error-pattern:fail
#[feature(managed_boxes)];
fn main() { fn main() {
@0; @0;
fail!(); fail!();

View File

@ -10,6 +10,7 @@
// error-pattern:fail // error-pattern:fail
#[feature(managed_boxes)];
#[allow(unreachable_code)]; #[allow(unreachable_code)];
#[allow(unused_variable)]; #[allow(unused_variable)];

View File

@ -10,6 +10,8 @@
// error-pattern:fail // error-pattern:fail
#[feature(managed_boxes)];
fn x(it: |int|) { fn x(it: |int|) {
let _a = @0; let _a = @0;
it(1); it(1);

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
// Issue #945 // Issue #945
// error-pattern:non-exhaustive match failure // error-pattern:non-exhaustive match failure
fn test_box() { fn test_box() {

View File

@ -11,6 +11,8 @@
// exec-env:RUST_NEWRT=1 // exec-env:RUST_NEWRT=1
// error-pattern:fail // error-pattern:fail
#[feature(managed_boxes)];
fn main() { fn main() {
let _count = @mut 0u; let _count = @mut 0u;
let mut map = std::hashmap::HashMap::new(); let mut map = std::hashmap::HashMap::new();

View File

@ -10,6 +10,8 @@
// error-pattern:fail // error-pattern:fail
#[feature(managed_boxes)];
fn main() { fn main() {
let _a = @0; let _a = @0;
{ {

View File

@ -10,6 +10,8 @@
// error-pattern:fail // error-pattern:fail
#[feature(managed_boxes)];
fn f() -> ~[int] { fail!(); } fn f() -> ~[int] { fail!(); }
// Voodoo. In unwind-alt we had to do this to trigger the bug. Might // Voodoo. In unwind-alt we had to do this to trigger the bug. Might

View File

@ -10,6 +10,8 @@
// error-pattern:fail // error-pattern:fail
#[feature(managed_boxes)];
fn f() -> ~[int] { fail!(); } fn f() -> ~[int] { fail!(); }
// Voodoo. In unwind-alt we had to do this to trigger the bug. Might // Voodoo. In unwind-alt we had to do this to trigger the bug. Might

View File

@ -10,6 +10,8 @@
// error-pattern:fail // error-pattern:fail
#[feature(managed_boxes)];
fn f() -> ~[int] { fail!(); } fn f() -> ~[int] { fail!(); }
// Voodoo. In unwind-alt we had to do this to trigger the bug. Might // Voodoo. In unwind-alt we had to do this to trigger the bug. Might

View File

@ -10,6 +10,8 @@
// error-pattern:fail // error-pattern:fail
#[feature(managed_boxes)];
fn f() { fn f() {
let _a = @0; let _a = @0;
fail!(); fail!();

View File

@ -10,6 +10,8 @@
// error-pattern:fail // error-pattern:fail
#[feature(managed_boxes)];
fn f() { fn f() {
fail!(); fail!();
} }

View File

@ -11,6 +11,8 @@
// Testing that method lookup automatically both borrows vectors to slices // Testing that method lookup automatically both borrows vectors to slices
// and also references them to create the &self pointer // and also references them to create the &self pointer
#[feature(managed_boxes)];
trait MyIter { trait MyIter {
fn test_imm(&self); fn test_imm(&self);
} }

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
trait double { trait double {
fn double(@self) -> uint; fn double(@self) -> uint;
} }

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
trait double { trait double {
fn double(@self) -> uint; fn double(@self) -> uint;
} }

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
fn sum_slice(x: &[int]) -> int { fn sum_slice(x: &[int]) -> int {
let mut sum = 0; let mut sum = 0;
for i in x.iter() { sum += *i; } for i in x.iter() { sum += *i; }

View File

@ -10,6 +10,8 @@
// exec-env:RUST_POISON_ON_FREE=1 // exec-env:RUST_POISON_ON_FREE=1
#[feature(managed_boxes)];
use std::ptr; use std::ptr;
struct F { f: ~int } struct F { f: ~int }

View File

@ -12,6 +12,8 @@
// exec-env:RUST_POISON_ON_FREE=1 // exec-env:RUST_POISON_ON_FREE=1
#[feature(managed_boxes)];
use std::ptr; use std::ptr;
fn borrow(x: &int, f: |x: &int|) { fn borrow(x: &int, f: |x: &int|) {

View File

@ -10,6 +10,8 @@
// exec-env:RUST_POISON_ON_FREE=1 // exec-env:RUST_POISON_ON_FREE=1
#[feature(managed_boxes)];
use std::ptr; use std::ptr;
struct F { f: ~int } struct F { f: ~int }

View File

@ -12,6 +12,8 @@
// exec-env:RUST_POISON_ON_FREE=1 // exec-env:RUST_POISON_ON_FREE=1
#[feature(managed_boxes)];
use std::ptr; use std::ptr;
fn borrow(x: &int, f: |x: &int|) { fn borrow(x: &int, f: |x: &int|) {

View File

@ -12,6 +12,8 @@
// exec-env:RUST_POISON_ON_FREE=1 // exec-env:RUST_POISON_ON_FREE=1
#[feature(managed_boxes)];
use std::ptr; use std::ptr;
fn borrow(x: &int, f: |x: &int|) { fn borrow(x: &int, f: |x: &int|) {

View File

@ -10,6 +10,8 @@
// exec-env:RUST_POISON_ON_FREE=1 // exec-env:RUST_POISON_ON_FREE=1
#[feature(managed_boxes)];
fn testfn(cond: bool) { fn testfn(cond: bool) {
let mut x = @3; let mut x = @3;
let mut y = @4; let mut y = @4;

View File

@ -12,6 +12,8 @@
// exec-env:RUST_POISON_ON_FREE=1 // exec-env:RUST_POISON_ON_FREE=1
#[feature(managed_boxes)];
use std::ptr; use std::ptr;
fn borrow(x: &int, f: |x: &int|) { fn borrow(x: &int, f: |x: &int|) {

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
enum newtype { enum newtype {
newtype(int) newtype(int)
} }

View File

@ -26,6 +26,7 @@
// //
// run-fail/borrowck-wg-autoderef-and-autoborrowvec-combined-fail-issue-6272.rs // run-fail/borrowck-wg-autoderef-and-autoborrowvec-combined-fail-issue-6272.rs
#[feature(managed_boxes)];
pub fn main() { pub fn main() {
let a = @mut 3i; let a = @mut 3i;

View File

@ -1,3 +1,5 @@
#[feature(managed_boxes)];
fn f(x: &int) { fn f(x: &int) {
println(x.to_str()); println(x.to_str());
} }

View File

@ -1,5 +1,7 @@
// Test that we can borrow the same @mut box twice, so long as both are imm. // Test that we can borrow the same @mut box twice, so long as both are imm.
#[feature(managed_boxes)];
fn add(x:&int, y:&int) fn add(x:&int, y:&int)
{ {
*x + *y; *x + *y;

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
pub fn main() { pub fn main() {
let (&x, &y, &z) = (&3, &'a', &@"No pets!"); let (&x, &y, &z) = (&3, &'a', &@"No pets!");
assert_eq!(x, 3); assert_eq!(x, 3);

View File

@ -11,6 +11,8 @@
// xfail-fast - check-fast doesn't understand aux-build // xfail-fast - check-fast doesn't understand aux-build
// aux-build:cci_borrow_lib.rs // aux-build:cci_borrow_lib.rs
#[feature(managed_boxes)];
extern mod cci_borrow_lib; extern mod cci_borrow_lib;
use cci_borrow_lib::foo; use cci_borrow_lib::foo;

View File

@ -8,6 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
pub fn main() { let x = @mut 5; *x = 1000; info!("{:?}", *x); } pub fn main() { let x = @mut 5; *x = 1000; info!("{:?}", *x); }

View File

@ -13,7 +13,7 @@
// xfail-fast // xfail-fast
#[feature(struct_variant)]; #[feature(struct_variant, managed_boxes)];
extern mod extra; extern mod extra;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
pub fn main() { let x = { @100 }; assert!((*x == 100)); } pub fn main() { let x = { @100 }; assert!((*x == 100)); }

View File

@ -8,5 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
// Regression test for issue #388 // Regression test for issue #388
pub fn main() { let _x = { { @10 } }; } pub fn main() { let _x = { { @10 } }; }

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
// Regression test for issue #388 // Regression test for issue #388
pub fn main() { pub fn main() {
let _x = if false { let _x = if false {

View File

@ -8,9 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
// Tests for if as expressions returning boxed types // Tests for if as expressions returning boxed types
fn test_box() { fn test_box() {

View File

@ -8,9 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
// Tests for match as expressions resulting in boxed types // Tests for match as expressions resulting in boxed types
fn test_box() { fn test_box() {

View File

@ -10,6 +10,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
/** /**
A somewhat reduced test case to expose some Valgrind issues. A somewhat reduced test case to expose some Valgrind issues.

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
mod rusti { mod rusti {
extern "rust-intrinsic" { extern "rust-intrinsic" {
pub fn move_val_init<T>(dst: &mut T, src: T); pub fn move_val_init<T>(dst: &mut T, src: T);

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
struct Font { struct Font {
fontbuf: uint, fontbuf: uint,
cairo_font: uint, cairo_font: uint,

View File

@ -10,6 +10,9 @@
// xfail-fast // xfail-fast
// aux-build:issue-3012-1.rs // aux-build:issue-3012-1.rs
#[feature(managed_boxes)];
extern mod socketlib; extern mod socketlib;
use socketlib::socket; use socketlib::socket;

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
struct Foo { x: int } struct Foo { x: int }
impl Foo { impl Foo {

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
use std::hashmap::HashMap; use std::hashmap::HashMap;
pub fn main() { pub fn main() {

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
pub fn main() { pub fn main() {
let box1 = @mut 42; let box1 = @mut 42;
let _x = *(&mut *box1) == 42 || *(&mut *box1) == 31337; let _x = *(&mut *box1) == 42 || *(&mut *box1) == 31337;

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
#[allow(unused_mut)]; #[allow(unused_mut)];
pub fn main() { pub fn main() {

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
pub fn main() { pub fn main() {
match Left(@17) { match Left(@17) {
Right(()) => {} Right(()) => {}

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
fn assert_repr_eq<T>(obj : T, expected : ~str) { fn assert_repr_eq<T>(obj : T, expected : ~str) {

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
#[allow(unnecessary_allocation)]; #[allow(unnecessary_allocation)];
// Tests for a previous bug that occured due to an interaction // Tests for a previous bug that occured due to an interaction

View File

@ -11,6 +11,7 @@
// This should typecheck even though the type of e is not fully // This should typecheck even though the type of e is not fully
// resolved when we finish typechecking the ||. // resolved when we finish typechecking the ||.
#[feature(managed_boxes)];
struct Refs { refs: ~[int], n: int } struct Refs { refs: ~[int], n: int }

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
struct xx(int); struct xx(int);
struct X { x: xx, y: int } struct X { x: xx, y: int }

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
struct X { x: int, y: int, z: int } struct X { x: int, y: int, z: int }

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
struct Foo { foo: bool, bar: Option<int>, baz: int } struct Foo { foo: bool, bar: Option<int>, baz: int }
pub fn main() { pub fn main() {

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
trait get { trait get {
fn get(self) -> int; fn get(self) -> int;
} }

View File

@ -10,6 +10,8 @@
/* Tests conditional rooting of the box y */ /* Tests conditional rooting of the box y */
#[feature(managed_boxes)];
fn testfn(cond: bool) { fn testfn(cond: bool) {
let mut x = @3; let mut x = @3;
let mut y = @4; let mut y = @4;

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
fn foo(x: &uint) -> uint { fn foo(x: &uint) -> uint {
*x *x
} }

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
fn foo(x: &[uint]) -> uint { fn foo(x: &[uint]) -> uint {
x[0] x[0]
} }

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
fn foo<'r>(x: &'r uint) -> &'r uint { x } fn foo<'r>(x: &'r uint) -> &'r uint { x }
fn bar(x: &uint) -> uint { *x } fn bar(x: &uint) -> uint { *x }

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
fn borrow<'r, T>(x: &'r T) -> &'r T {x} fn borrow<'r, T>(x: &'r T) -> &'r T {x}
pub fn main() { pub fn main() {

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
struct Point {x: int, y: int} struct Point {x: int, y: int}
fn x_coord<'r>(p: &'r Point) -> &'r int { fn x_coord<'r>(p: &'r Point) -> &'r int {

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
#[deriving(Clone)] #[deriving(Clone)]
struct Foo { struct Foo {
a: ~str, a: ~str,

View File

@ -1,3 +1,5 @@
#[feature(managed_boxes)];
struct Foo<'a> { struct Foo<'a> {
x: &'a int x: &'a int
} }

View File

@ -10,6 +10,8 @@
// xfail-fast // xfail-fast
#[feature(managed_boxes)];
fn p_foo<T>(_pinned: T) { } fn p_foo<T>(_pinned: T) { }
fn s_foo<T>(_shared: T) { } fn s_foo<T>(_shared: T) { }
fn u_foo<T:Send>(_unique: T) { } fn u_foo<T:Send>(_unique: T) { }

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
fn f<T>(t: T) -> T { fn f<T>(t: T) -> T {
let t1 = t; let t1 = t;
t1 t1

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
#[allow(unused_variable)]; #[allow(unused_variable)];
use std::managed; use std::managed;

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
extern mod extra; extern mod extra;
use std::task; use std::task;

View File

@ -1,3 +1,5 @@
#[feature(managed_boxes)];
pub fn main() { pub fn main() {
let x = @[1, 2, 3]; let x = @[1, 2, 3];
match x { match x {

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[feature(managed_boxes)];
pub fn main() { pub fn main() {
assert_eq!((~[0, 1]).to_str(), ~"[0, 1]"); assert_eq!((~[0, 1]).to_str(), ~"[0, 1]");
assert_eq!((&[1, 2]).to_str(), ~"[1, 2]"); assert_eq!((&[1, 2]).to_str(), ~"[1, 2]");