diff --git a/src/librustc/front/feature_gate.rs b/src/librustc/front/feature_gate.rs index 868b53c2465..6bbf18de693 100644 --- a/src/librustc/front/feature_gate.rs +++ b/src/librustc/front/feature_gate.rs @@ -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 { self.features.iter().any(|n| n.as_slice() == feature) } @@ -172,17 +180,24 @@ impl Visitor<()> for Context { experimental and likely to be removed"); }, - ast::ty_box(_) => { - 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."); - } + ast::ty_box(_) => { self.gate_box(t.span); } _ => {} } 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) { diff --git a/src/test/compile-fail/auto-ref-slice-plus-ref.rs b/src/test/compile-fail/auto-ref-slice-plus-ref.rs index 9f73955f29e..311becc63ef 100644 --- a/src/test/compile-fail/auto-ref-slice-plus-ref.rs +++ b/src/test/compile-fail/auto-ref-slice-plus-ref.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + fn main() { // Testing that method lookup does not automatically borrow diff --git a/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs b/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs index b205c5be217..bfc1884ac5a 100644 --- a/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs +++ b/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + struct Point { x: int, y: int, diff --git a/src/test/compile-fail/borrowck-loan-rcvr.rs b/src/test/compile-fail/borrowck-loan-rcvr.rs index c2ed3378bf9..5c6f7082ed0 100644 --- a/src/test/compile-fail/borrowck-loan-rcvr.rs +++ b/src/test/compile-fail/borrowck-loan-rcvr.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + struct point { x: int, y: int } trait methods { diff --git a/src/test/compile-fail/borrowck-mut-boxed-vec.rs b/src/test/compile-fail/borrowck-mut-boxed-vec.rs index 1a8fa50c76e..84c2db8bd57 100644 --- a/src/test/compile-fail/borrowck-mut-boxed-vec.rs +++ b/src/test/compile-fail/borrowck-mut-boxed-vec.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + fn main() { let v = @mut [ 1, 2, 3 ]; for _x in v.iter() { diff --git a/src/test/compile-fail/issue-3763.rs b/src/test/compile-fail/issue-3763.rs index 7097615b87e..a4d184e346b 100644 --- a/src/test/compile-fail/issue-3763.rs +++ b/src/test/compile-fail/issue-3763.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + mod my_mod { pub struct MyStruct { priv priv_field: int diff --git a/src/test/compile-fail/moves-based-on-type-exprs.rs b/src/test/compile-fail/moves-based-on-type-exprs.rs index fec0f89adba..34e506ed015 100644 --- a/src/test/compile-fail/moves-based-on-type-exprs.rs +++ b/src/test/compile-fail/moves-based-on-type-exprs.rs @@ -1,6 +1,8 @@ // Tests that references to move-by-default values trigger moves when // they occur as part of various kinds of expressions. +#[feature(managed_boxes)]; + struct Foo { f: A } fn guard(_s: ~str) -> bool {fail!()} fn touch(_a: &A) {} diff --git a/src/test/compile-fail/non-exhaustive-match.rs b/src/test/compile-fail/non-exhaustive-match.rs index e728b9c2fd7..c8183d70f87 100644 --- a/src/test/compile-fail/non-exhaustive-match.rs +++ b/src/test/compile-fail/non-exhaustive-match.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + enum t { a, b, } fn main() { diff --git a/src/test/compile-fail/occurs-check.rs b/src/test/compile-fail/occurs-check.rs index d6a5a747e8d..f08272f58ac 100644 --- a/src/test/compile-fail/occurs-check.rs +++ b/src/test/compile-fail/occurs-check.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + fn main() { let f; //~ ERROR cyclic type of infinite size f = @f; diff --git a/src/test/compile-fail/static-region-bound.rs b/src/test/compile-fail/static-region-bound.rs index ada3aebb2f4..35f5ac1bb18 100644 --- a/src/test/compile-fail/static-region-bound.rs +++ b/src/test/compile-fail/static-region-bound.rs @@ -1,3 +1,5 @@ +#[feature(managed_boxes)]; + fn f(_: T) {} fn main() { diff --git a/src/test/compile-fail/unique-unique-kind.rs b/src/test/compile-fail/unique-unique-kind.rs index d51df4979e3..b9965b18229 100644 --- a/src/test/compile-fail/unique-unique-kind.rs +++ b/src/test/compile-fail/unique-unique-kind.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + fn f(_i: T) { } diff --git a/src/test/run-fail/borrowck-wg-autoderef-and-autoborrowvec-combined-fail-issue-6272.rs b/src/test/run-fail/borrowck-wg-autoderef-and-autoborrowvec-combined-fail-issue-6272.rs index 6e15f6edddc..c9bc061995d 100644 --- a/src/test/run-fail/borrowck-wg-autoderef-and-autoborrowvec-combined-fail-issue-6272.rs +++ b/src/test/run-fail/borrowck-wg-autoderef-and-autoborrowvec-combined-fail-issue-6272.rs @@ -8,6 +8,8 @@ // // for a detailed explanation of what is going on here. +#[feature(managed_boxes)]; + fn main() { let a = @mut [3i]; let b = @mut [a]; diff --git a/src/test/run-fail/borrowck-wg-fail-2.rs b/src/test/run-fail/borrowck-wg-fail-2.rs index 24b928920c2..284882ff6f5 100644 --- a/src/test/run-fail/borrowck-wg-fail-2.rs +++ b/src/test/run-fail/borrowck-wg-fail-2.rs @@ -3,6 +3,8 @@ // Test that write guards trigger when there is a write to a field // of a frozen structure. +#[feature(managed_boxes)]; + struct S { x: int } diff --git a/src/test/run-fail/borrowck-wg-fail-3.rs b/src/test/run-fail/borrowck-wg-fail-3.rs index 8a72d2680d9..2643ed261f9 100644 --- a/src/test/run-fail/borrowck-wg-fail-3.rs +++ b/src/test/run-fail/borrowck-wg-fail-3.rs @@ -3,6 +3,8 @@ // Test that write guards trigger when there is a write to a directly // frozen @mut box. +#[feature(managed_boxes)]; + fn main() { let x = @mut 3; let _y: &mut int = x; diff --git a/src/test/run-fail/borrowck-wg-one-mut-one-imm-slice-method.rs b/src/test/run-fail/borrowck-wg-one-mut-one-imm-slice-method.rs index 668fa54315e..d33e39e09a8 100644 --- a/src/test/run-fail/borrowck-wg-one-mut-one-imm-slice-method.rs +++ b/src/test/run-fail/borrowck-wg-one-mut-one-imm-slice-method.rs @@ -3,6 +3,8 @@ // Test that write guards trigger when there is a coercion to // a slice on the receiver of a method. +#[feature(managed_boxes)]; + trait MyMutSlice { fn my_mut_slice(self) -> Self; } diff --git a/src/test/run-fail/borrowck-wg-one-mut-one-imm-slices.rs b/src/test/run-fail/borrowck-wg-one-mut-one-imm-slices.rs index ef410fb5339..63287981bdc 100644 --- a/src/test/run-fail/borrowck-wg-one-mut-one-imm-slices.rs +++ b/src/test/run-fail/borrowck-wg-one-mut-one-imm-slices.rs @@ -2,6 +2,8 @@ // Test that write guards trigger when arguments are coerced to slices. +#[feature(managed_boxes)]; + fn add(x:&mut [int], y:&[int]) { x[0] = x[0] + y[0]; diff --git a/src/test/run-fail/borrowck-wg-one-mut-one-imm.rs b/src/test/run-fail/borrowck-wg-one-mut-one-imm.rs index 9e52c3ae928..0820b94e181 100644 --- a/src/test/run-fail/borrowck-wg-one-mut-one-imm.rs +++ b/src/test/run-fail/borrowck-wg-one-mut-one-imm.rs @@ -3,6 +3,8 @@ // Test that write guards trigger when we are indexing into // an @mut vector. +#[feature(managed_boxes)]; + fn add(x:&mut int, y:&int) { *x = *x + *y; diff --git a/src/test/run-fail/borrowck-wg-two-array-indices.rs b/src/test/run-fail/borrowck-wg-two-array-indices.rs index a41e529d062..5ee9cd37e87 100644 --- a/src/test/run-fail/borrowck-wg-two-array-indices.rs +++ b/src/test/run-fail/borrowck-wg-two-array-indices.rs @@ -3,6 +3,8 @@ // Test that arguments trigger when there are *two mutable* borrows // of indices. +#[feature(managed_boxes)]; + fn add(x:&mut int, y:&mut int) { *x = *x + *y; diff --git a/src/test/run-fail/unwind-assert.rs b/src/test/run-fail/unwind-assert.rs index 36954d2bad6..4ed79147947 100644 --- a/src/test/run-fail/unwind-assert.rs +++ b/src/test/run-fail/unwind-assert.rs @@ -10,6 +10,8 @@ // error-pattern:fail +#[feature(managed_boxes)]; + fn main() { let _a = @0; assert!(false); diff --git a/src/test/run-fail/unwind-box-res.rs b/src/test/run-fail/unwind-box-res.rs index f0d6e1c1882..6740331d2f0 100644 --- a/src/test/run-fail/unwind-box-res.rs +++ b/src/test/run-fail/unwind-box-res.rs @@ -10,6 +10,8 @@ // error-pattern:fail +#[feature(managed_boxes)]; + use std::cast; fn failfn() { diff --git a/src/test/run-fail/unwind-box-str.rs b/src/test/run-fail/unwind-box-str.rs index a30f2bfab0a..410b86d5714 100644 --- a/src/test/run-fail/unwind-box-str.rs +++ b/src/test/run-fail/unwind-box-str.rs @@ -10,6 +10,8 @@ // error-pattern:fail +#[feature(managed_boxes)]; + fn failfn() { fail!(); } diff --git a/src/test/run-fail/unwind-box-unique-unique.rs b/src/test/run-fail/unwind-box-unique-unique.rs index fc8e3a793d2..c4747c6089e 100644 --- a/src/test/run-fail/unwind-box-unique-unique.rs +++ b/src/test/run-fail/unwind-box-unique-unique.rs @@ -10,6 +10,8 @@ // error-pattern:fail +#[feature(managed_boxes)]; + fn failfn() { fail!(); } diff --git a/src/test/run-fail/unwind-box-unique.rs b/src/test/run-fail/unwind-box-unique.rs index 15925dc475e..e99c050d16a 100644 --- a/src/test/run-fail/unwind-box-unique.rs +++ b/src/test/run-fail/unwind-box-unique.rs @@ -10,6 +10,8 @@ // error-pattern:fail +#[feature(managed_boxes)]; + fn failfn() { fail!(); } diff --git a/src/test/run-fail/unwind-box-vec.rs b/src/test/run-fail/unwind-box-vec.rs index 18b4cebaa33..4a5cd270116 100644 --- a/src/test/run-fail/unwind-box-vec.rs +++ b/src/test/run-fail/unwind-box-vec.rs @@ -10,6 +10,8 @@ // error-pattern:fail +#[feature(managed_boxes)]; + fn failfn() { fail!(); } diff --git a/src/test/run-fail/unwind-box.rs b/src/test/run-fail/unwind-box.rs index 21308945253..6cbccfb29f9 100644 --- a/src/test/run-fail/unwind-box.rs +++ b/src/test/run-fail/unwind-box.rs @@ -10,6 +10,8 @@ // error-pattern:fail +#[feature(managed_boxes)]; + fn failfn() { fail!(); } diff --git a/src/test/run-fail/unwind-fail.rs b/src/test/run-fail/unwind-fail.rs index 4d4bc0d53eb..4acd1ba6b1b 100644 --- a/src/test/run-fail/unwind-fail.rs +++ b/src/test/run-fail/unwind-fail.rs @@ -10,6 +10,8 @@ // error-pattern:fail +#[feature(managed_boxes)]; + fn main() { @0; fail!(); diff --git a/src/test/run-fail/unwind-iter.rs b/src/test/run-fail/unwind-iter.rs index 1f5e455564e..9b5b9be3415 100644 --- a/src/test/run-fail/unwind-iter.rs +++ b/src/test/run-fail/unwind-iter.rs @@ -10,6 +10,7 @@ // error-pattern:fail +#[feature(managed_boxes)]; #[allow(unreachable_code)]; #[allow(unused_variable)]; diff --git a/src/test/run-fail/unwind-iter2.rs b/src/test/run-fail/unwind-iter2.rs index d0726d2544c..0ac8b2b26e9 100644 --- a/src/test/run-fail/unwind-iter2.rs +++ b/src/test/run-fail/unwind-iter2.rs @@ -10,6 +10,8 @@ // error-pattern:fail +#[feature(managed_boxes)]; + fn x(it: |int|) { let _a = @0; it(1); diff --git a/src/test/run-fail/unwind-match.rs b/src/test/run-fail/unwind-match.rs index a9761017c73..44cc3145c44 100644 --- a/src/test/run-fail/unwind-match.rs +++ b/src/test/run-fail/unwind-match.rs @@ -8,6 +8,8 @@ // 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 fn test_box() { diff --git a/src/test/run-fail/unwind-misc-1.rs b/src/test/run-fail/unwind-misc-1.rs index d215927c7d0..b87303467ce 100644 --- a/src/test/run-fail/unwind-misc-1.rs +++ b/src/test/run-fail/unwind-misc-1.rs @@ -11,6 +11,8 @@ // exec-env:RUST_NEWRT=1 // error-pattern:fail +#[feature(managed_boxes)]; + fn main() { let _count = @mut 0u; let mut map = std::hashmap::HashMap::new(); diff --git a/src/test/run-fail/unwind-nested.rs b/src/test/run-fail/unwind-nested.rs index f8a63be2e9a..3805f955d73 100644 --- a/src/test/run-fail/unwind-nested.rs +++ b/src/test/run-fail/unwind-nested.rs @@ -10,6 +10,8 @@ // error-pattern:fail +#[feature(managed_boxes)]; + fn main() { let _a = @0; { diff --git a/src/test/run-fail/unwind-partial-box.rs b/src/test/run-fail/unwind-partial-box.rs index 88f71a5ed7c..7239cad762d 100644 --- a/src/test/run-fail/unwind-partial-box.rs +++ b/src/test/run-fail/unwind-partial-box.rs @@ -10,6 +10,8 @@ // error-pattern:fail +#[feature(managed_boxes)]; + fn f() -> ~[int] { fail!(); } // Voodoo. In unwind-alt we had to do this to trigger the bug. Might diff --git a/src/test/run-fail/unwind-partial-unique.rs b/src/test/run-fail/unwind-partial-unique.rs index e9bbbd46c03..6339e72fe46 100644 --- a/src/test/run-fail/unwind-partial-unique.rs +++ b/src/test/run-fail/unwind-partial-unique.rs @@ -10,6 +10,8 @@ // error-pattern:fail +#[feature(managed_boxes)]; + fn f() -> ~[int] { fail!(); } // Voodoo. In unwind-alt we had to do this to trigger the bug. Might diff --git a/src/test/run-fail/unwind-partial-vec.rs b/src/test/run-fail/unwind-partial-vec.rs index 3d6d26937db..9560e0275d4 100644 --- a/src/test/run-fail/unwind-partial-vec.rs +++ b/src/test/run-fail/unwind-partial-vec.rs @@ -10,6 +10,8 @@ // error-pattern:fail +#[feature(managed_boxes)]; + fn f() -> ~[int] { fail!(); } // Voodoo. In unwind-alt we had to do this to trigger the bug. Might diff --git a/src/test/run-fail/unwind-stacked.rs b/src/test/run-fail/unwind-stacked.rs index 8249807af74..bd875ada18e 100644 --- a/src/test/run-fail/unwind-stacked.rs +++ b/src/test/run-fail/unwind-stacked.rs @@ -10,6 +10,8 @@ // error-pattern:fail +#[feature(managed_boxes)]; + fn f() { let _a = @0; fail!(); diff --git a/src/test/run-fail/unwind-uninitialized.rs b/src/test/run-fail/unwind-uninitialized.rs index d5a06ffb903..265a616f3de 100644 --- a/src/test/run-fail/unwind-uninitialized.rs +++ b/src/test/run-fail/unwind-uninitialized.rs @@ -10,6 +10,8 @@ // error-pattern:fail +#[feature(managed_boxes)]; + fn f() { fail!(); } diff --git a/src/test/run-pass/auto-ref-slice-plus-ref.rs b/src/test/run-pass/auto-ref-slice-plus-ref.rs index 2b9870b84a5..667d9b738c2 100644 --- a/src/test/run-pass/auto-ref-slice-plus-ref.rs +++ b/src/test/run-pass/auto-ref-slice-plus-ref.rs @@ -11,6 +11,8 @@ // Testing that method lookup automatically both borrows vectors to slices // and also references them to create the &self pointer +#[feature(managed_boxes)]; + trait MyIter { fn test_imm(&self); } diff --git a/src/test/run-pass/autoderef-method-twice.rs b/src/test/run-pass/autoderef-method-twice.rs index f93f0605269..79784688d49 100644 --- a/src/test/run-pass/autoderef-method-twice.rs +++ b/src/test/run-pass/autoderef-method-twice.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + trait double { fn double(@self) -> uint; } diff --git a/src/test/run-pass/autoderef-method.rs b/src/test/run-pass/autoderef-method.rs index eb173e3d5f8..1a04abe3196 100644 --- a/src/test/run-pass/autoderef-method.rs +++ b/src/test/run-pass/autoderef-method.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + trait double { fn double(@self) -> uint; } diff --git a/src/test/run-pass/borrowck-borrow-from-at-vec.rs b/src/test/run-pass/borrowck-borrow-from-at-vec.rs index 8ec1b590fdf..5ae959ef169 100644 --- a/src/test/run-pass/borrowck-borrow-from-at-vec.rs +++ b/src/test/run-pass/borrowck-borrow-from-at-vec.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + fn sum_slice(x: &[int]) -> int { let mut sum = 0; for i in x.iter() { sum += *i; } diff --git a/src/test/run-pass/borrowck-preserve-box-in-discr.rs b/src/test/run-pass/borrowck-preserve-box-in-discr.rs index c155563d8d0..0f37288d51d 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-discr.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-discr.rs @@ -10,6 +10,8 @@ // exec-env:RUST_POISON_ON_FREE=1 +#[feature(managed_boxes)]; + use std::ptr; struct F { f: ~int } diff --git a/src/test/run-pass/borrowck-preserve-box-in-field.rs b/src/test/run-pass/borrowck-preserve-box-in-field.rs index 1caf5c03376..77fe7d14dcb 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-field.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-field.rs @@ -12,6 +12,8 @@ // exec-env:RUST_POISON_ON_FREE=1 +#[feature(managed_boxes)]; + use std::ptr; fn borrow(x: &int, f: |x: &int|) { diff --git a/src/test/run-pass/borrowck-preserve-box-in-pat.rs b/src/test/run-pass/borrowck-preserve-box-in-pat.rs index fd5f8c0868c..2fd2c689a3c 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-pat.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-pat.rs @@ -10,6 +10,8 @@ // exec-env:RUST_POISON_ON_FREE=1 +#[feature(managed_boxes)]; + use std::ptr; struct F { f: ~int } diff --git a/src/test/run-pass/borrowck-preserve-box-in-uniq.rs b/src/test/run-pass/borrowck-preserve-box-in-uniq.rs index 2b8180be00e..d950fce109b 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-uniq.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-uniq.rs @@ -12,6 +12,8 @@ // exec-env:RUST_POISON_ON_FREE=1 +#[feature(managed_boxes)]; + use std::ptr; fn borrow(x: &int, f: |x: &int|) { diff --git a/src/test/run-pass/borrowck-preserve-box.rs b/src/test/run-pass/borrowck-preserve-box.rs index 2acaf54f05f..5c0f238e0bc 100644 --- a/src/test/run-pass/borrowck-preserve-box.rs +++ b/src/test/run-pass/borrowck-preserve-box.rs @@ -12,6 +12,8 @@ // exec-env:RUST_POISON_ON_FREE=1 +#[feature(managed_boxes)]; + use std::ptr; fn borrow(x: &int, f: |x: &int|) { diff --git a/src/test/run-pass/borrowck-preserve-cond-box.rs b/src/test/run-pass/borrowck-preserve-cond-box.rs index 055a924cf04..57365e98f97 100644 --- a/src/test/run-pass/borrowck-preserve-cond-box.rs +++ b/src/test/run-pass/borrowck-preserve-cond-box.rs @@ -10,6 +10,8 @@ // exec-env:RUST_POISON_ON_FREE=1 +#[feature(managed_boxes)]; + fn testfn(cond: bool) { let mut x = @3; let mut y = @4; diff --git a/src/test/run-pass/borrowck-preserve-expl-deref.rs b/src/test/run-pass/borrowck-preserve-expl-deref.rs index 4400b03e313..e820ec67d6f 100644 --- a/src/test/run-pass/borrowck-preserve-expl-deref.rs +++ b/src/test/run-pass/borrowck-preserve-expl-deref.rs @@ -12,6 +12,8 @@ // exec-env:RUST_POISON_ON_FREE=1 +#[feature(managed_boxes)]; + use std::ptr; fn borrow(x: &int, f: |x: &int|) { diff --git a/src/test/run-pass/borrowck-univariant-enum.rs b/src/test/run-pass/borrowck-univariant-enum.rs index bb8710aad48..aaa08ea49b3 100644 --- a/src/test/run-pass/borrowck-univariant-enum.rs +++ b/src/test/run-pass/borrowck-univariant-enum.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + enum newtype { newtype(int) } diff --git a/src/test/run-pass/borrowck-wg-autoderef-and-autoborrowvec-combined-issue-6272.rs b/src/test/run-pass/borrowck-wg-autoderef-and-autoborrowvec-combined-issue-6272.rs index 4ee0d42ae13..27d337a28bf 100644 --- a/src/test/run-pass/borrowck-wg-autoderef-and-autoborrowvec-combined-issue-6272.rs +++ b/src/test/run-pass/borrowck-wg-autoderef-and-autoborrowvec-combined-issue-6272.rs @@ -26,6 +26,7 @@ // // run-fail/borrowck-wg-autoderef-and-autoborrowvec-combined-fail-issue-6272.rs +#[feature(managed_boxes)]; pub fn main() { let a = @mut 3i; diff --git a/src/test/run-pass/borrowck-wg-simple.rs b/src/test/run-pass/borrowck-wg-simple.rs index c07962e10aa..f561dba2423 100644 --- a/src/test/run-pass/borrowck-wg-simple.rs +++ b/src/test/run-pass/borrowck-wg-simple.rs @@ -1,3 +1,5 @@ +#[feature(managed_boxes)]; + fn f(x: &int) { println(x.to_str()); } diff --git a/src/test/run-pass/borrowck-wg-two-imm-borrows.rs b/src/test/run-pass/borrowck-wg-two-imm-borrows.rs index 3d2988202f3..efd0572c8c6 100644 --- a/src/test/run-pass/borrowck-wg-two-imm-borrows.rs +++ b/src/test/run-pass/borrowck-wg-two-imm-borrows.rs @@ -1,5 +1,7 @@ // 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) { *x + *y; diff --git a/src/test/run-pass/borrowed-ptr-pattern-infallible.rs b/src/test/run-pass/borrowed-ptr-pattern-infallible.rs index 4e9ba6d3158..77484b8da4a 100644 --- a/src/test/run-pass/borrowed-ptr-pattern-infallible.rs +++ b/src/test/run-pass/borrowed-ptr-pattern-infallible.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + pub fn main() { let (&x, &y, &z) = (&3, &'a', &@"No pets!"); assert_eq!(x, 3); diff --git a/src/test/run-pass/cci_borrow.rs b/src/test/run-pass/cci_borrow.rs index fe57d6b3fec..6b8f4089fdf 100644 --- a/src/test/run-pass/cci_borrow.rs +++ b/src/test/run-pass/cci_borrow.rs @@ -11,6 +11,8 @@ // xfail-fast - check-fast doesn't understand aux-build // aux-build:cci_borrow_lib.rs +#[feature(managed_boxes)]; + extern mod cci_borrow_lib; use cci_borrow_lib::foo; diff --git a/src/test/run-pass/deref-lval.rs b/src/test/run-pass/deref-lval.rs index e7a307c4a22..997e2f03abd 100644 --- a/src/test/run-pass/deref-lval.rs +++ b/src/test/run-pass/deref-lval.rs @@ -8,6 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - +#[feature(managed_boxes)]; pub fn main() { let x = @mut 5; *x = 1000; info!("{:?}", *x); } diff --git a/src/test/run-pass/deriving-encodable-decodable.rs b/src/test/run-pass/deriving-encodable-decodable.rs index 5f3cebed667..e9620d4dea4 100644 --- a/src/test/run-pass/deriving-encodable-decodable.rs +++ b/src/test/run-pass/deriving-encodable-decodable.rs @@ -13,7 +13,7 @@ // xfail-fast -#[feature(struct_variant)]; +#[feature(struct_variant, managed_boxes)]; extern mod extra; diff --git a/src/test/run-pass/expr-block-box.rs b/src/test/run-pass/expr-block-box.rs index af1fab2b595..6d6a2a60af0 100644 --- a/src/test/run-pass/expr-block-box.rs +++ b/src/test/run-pass/expr-block-box.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - - +#[feature(managed_boxes)]; pub fn main() { let x = { @100 }; assert!((*x == 100)); } diff --git a/src/test/run-pass/expr-block-ref.rs b/src/test/run-pass/expr-block-ref.rs index c77cad8858e..8ed2a9a6b3f 100644 --- a/src/test/run-pass/expr-block-ref.rs +++ b/src/test/run-pass/expr-block-ref.rs @@ -8,5 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + // Regression test for issue #388 pub fn main() { let _x = { { @10 } }; } diff --git a/src/test/run-pass/expr-elseif-ref2.rs b/src/test/run-pass/expr-elseif-ref2.rs index 96acaf43e34..3149ed49f7e 100644 --- a/src/test/run-pass/expr-elseif-ref2.rs +++ b/src/test/run-pass/expr-elseif-ref2.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + // Regression test for issue #388 pub fn main() { let _x = if false { diff --git a/src/test/run-pass/expr-if-box.rs b/src/test/run-pass/expr-if-box.rs index d31723f9c6c..b83c7b8852c 100644 --- a/src/test/run-pass/expr-if-box.rs +++ b/src/test/run-pass/expr-if-box.rs @@ -8,9 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - - - +#[feature(managed_boxes)]; // Tests for if as expressions returning boxed types fn test_box() { diff --git a/src/test/run-pass/expr-match-box.rs b/src/test/run-pass/expr-match-box.rs index 5e6abc3e786..8557f409b75 100644 --- a/src/test/run-pass/expr-match-box.rs +++ b/src/test/run-pass/expr-match-box.rs @@ -8,9 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - - - +#[feature(managed_boxes)]; // Tests for match as expressions resulting in boxed types fn test_box() { diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index e16cfecb694..163a1253ef0 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -10,6 +10,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + /** A somewhat reduced test case to expose some Valgrind issues. diff --git a/src/test/run-pass/intrinsic-move-val.rs b/src/test/run-pass/intrinsic-move-val.rs index f328c484478..1d2b0197f08 100644 --- a/src/test/run-pass/intrinsic-move-val.rs +++ b/src/test/run-pass/intrinsic-move-val.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + mod rusti { extern "rust-intrinsic" { pub fn move_val_init(dst: &mut T, src: T); diff --git a/src/test/run-pass/issue-2708.rs b/src/test/run-pass/issue-2708.rs index 1fce8e5ce49..e4d7483c5cf 100644 --- a/src/test/run-pass/issue-2708.rs +++ b/src/test/run-pass/issue-2708.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + struct Font { fontbuf: uint, cairo_font: uint, diff --git a/src/test/run-pass/issue-3012-2.rs b/src/test/run-pass/issue-3012-2.rs index c57257502e4..9d379e8bfe7 100644 --- a/src/test/run-pass/issue-3012-2.rs +++ b/src/test/run-pass/issue-3012-2.rs @@ -10,6 +10,9 @@ // xfail-fast // aux-build:issue-3012-1.rs + +#[feature(managed_boxes)]; + extern mod socketlib; use socketlib::socket; diff --git a/src/test/run-pass/issue-3860.rs b/src/test/run-pass/issue-3860.rs index ee9516e552e..8a30cc96748 100644 --- a/src/test/run-pass/issue-3860.rs +++ b/src/test/run-pass/issue-3860.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + struct Foo { x: int } impl Foo { diff --git a/src/test/run-pass/issue-4092.rs b/src/test/run-pass/issue-4092.rs index 919c1f7ad18..62174a70d07 100644 --- a/src/test/run-pass/issue-4092.rs +++ b/src/test/run-pass/issue-4092.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + use std::hashmap::HashMap; pub fn main() { diff --git a/src/test/run-pass/issue-5517.rs b/src/test/run-pass/issue-5517.rs index d63d8b13b43..a5c318a20f4 100644 --- a/src/test/run-pass/issue-5517.rs +++ b/src/test/run-pass/issue-5517.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + pub fn main() { let box1 = @mut 42; let _x = *(&mut *box1) == 42 || *(&mut *box1) == 31337; diff --git a/src/test/run-pass/issue-5926.rs b/src/test/run-pass/issue-5926.rs index dbaa5460fd0..ffb7a0a5bb3 100644 --- a/src/test/run-pass/issue-5926.rs +++ b/src/test/run-pass/issue-5926.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; #[allow(unused_mut)]; pub fn main() { diff --git a/src/test/run-pass/issue-6117.rs b/src/test/run-pass/issue-6117.rs index 73e9391f016..6b68e3c9ed7 100644 --- a/src/test/run-pass/issue-6117.rs +++ b/src/test/run-pass/issue-6117.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + pub fn main() { match Left(@17) { Right(()) => {} diff --git a/src/test/run-pass/issue-8898.rs b/src/test/run-pass/issue-8898.rs index 07731020d34..ecb8e3ca0ed 100644 --- a/src/test/run-pass/issue-8898.rs +++ b/src/test/run-pass/issue-8898.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; fn assert_repr_eq(obj : T, expected : ~str) { diff --git a/src/test/run-pass/issue-9382.rs b/src/test/run-pass/issue-9382.rs index d2bf6e29f87..a5f87e6c536 100644 --- a/src/test/run-pass/issue-9382.rs +++ b/src/test/run-pass/issue-9382.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; #[allow(unnecessary_allocation)]; // Tests for a previous bug that occured due to an interaction diff --git a/src/test/run-pass/lambda-infer-unresolved.rs b/src/test/run-pass/lambda-infer-unresolved.rs index b6ee2d10fb3..a499c148025 100644 --- a/src/test/run-pass/lambda-infer-unresolved.rs +++ b/src/test/run-pass/lambda-infer-unresolved.rs @@ -11,6 +11,7 @@ // This should typecheck even though the type of e is not fully // resolved when we finish typechecking the ||. +#[feature(managed_boxes)]; struct Refs { refs: ~[int], n: int } diff --git a/src/test/run-pass/let-destruct.rs b/src/test/run-pass/let-destruct.rs index aab19b31397..a1453a38455 100644 --- a/src/test/run-pass/let-destruct.rs +++ b/src/test/run-pass/let-destruct.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + struct xx(int); struct X { x: xx, y: int } diff --git a/src/test/run-pass/move-2.rs b/src/test/run-pass/move-2.rs index fb5f3e11ab7..14d4ea3ff35 100644 --- a/src/test/run-pass/move-2.rs +++ b/src/test/run-pass/move-2.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; struct X { x: int, y: int, z: int } diff --git a/src/test/run-pass/nested-exhaustive-match.rs b/src/test/run-pass/nested-exhaustive-match.rs index fa4bec0271f..aa25d13e0cd 100644 --- a/src/test/run-pass/nested-exhaustive-match.rs +++ b/src/test/run-pass/nested-exhaustive-match.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + struct Foo { foo: bool, bar: Option, baz: int } pub fn main() { diff --git a/src/test/run-pass/rcvr-borrowed-to-region.rs b/src/test/run-pass/rcvr-borrowed-to-region.rs index 7d07cab433f..d6d015d4785 100644 --- a/src/test/run-pass/rcvr-borrowed-to-region.rs +++ b/src/test/run-pass/rcvr-borrowed-to-region.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + trait get { fn get(self) -> int; } diff --git a/src/test/run-pass/regions-appearance-constraint.rs b/src/test/run-pass/regions-appearance-constraint.rs index 2297277fdc0..3b0a457559c 100644 --- a/src/test/run-pass/regions-appearance-constraint.rs +++ b/src/test/run-pass/regions-appearance-constraint.rs @@ -10,6 +10,8 @@ /* Tests conditional rooting of the box y */ +#[feature(managed_boxes)]; + fn testfn(cond: bool) { let mut x = @3; let mut y = @4; diff --git a/src/test/run-pass/regions-borrow-at.rs b/src/test/run-pass/regions-borrow-at.rs index b4ec9914f26..5b1b1dd8ec3 100644 --- a/src/test/run-pass/regions-borrow-at.rs +++ b/src/test/run-pass/regions-borrow-at.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + fn foo(x: &uint) -> uint { *x } diff --git a/src/test/run-pass/regions-borrow-evec-at.rs b/src/test/run-pass/regions-borrow-evec-at.rs index 45e5b1ad9c9..3c0fcba2064 100644 --- a/src/test/run-pass/regions-borrow-evec-at.rs +++ b/src/test/run-pass/regions-borrow-evec-at.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + fn foo(x: &[uint]) -> uint { x[0] } 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 986071ec535..8ccda6824bd 100644 --- a/src/test/run-pass/regions-escape-into-other-fn.rs +++ b/src/test/run-pass/regions-escape-into-other-fn.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + fn foo<'r>(x: &'r uint) -> &'r uint { x } fn bar(x: &uint) -> uint { *x } 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 db4a51bbf22..1f21ca9ef1b 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,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + fn borrow<'r, T>(x: &'r T) -> &'r T {x} pub fn main() { diff --git a/src/test/run-pass/regions-infer-borrow-scope.rs b/src/test/run-pass/regions-infer-borrow-scope.rs index 6bd3fa5a73b..7db4ce8caf2 100644 --- a/src/test/run-pass/regions-infer-borrow-scope.rs +++ b/src/test/run-pass/regions-infer-borrow-scope.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + struct Point {x: int, y: int} fn x_coord<'r>(p: &'r Point) -> &'r int { diff --git a/src/test/run-pass/repeated-vector-syntax.rs b/src/test/run-pass/repeated-vector-syntax.rs index 465c9b7090e..03497de0d55 100644 --- a/src/test/run-pass/repeated-vector-syntax.rs +++ b/src/test/run-pass/repeated-vector-syntax.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + #[deriving(Clone)] struct Foo { a: ~str, diff --git a/src/test/run-pass/struct-field-assignability.rs b/src/test/run-pass/struct-field-assignability.rs index 86656b011dd..da00e1595de 100644 --- a/src/test/run-pass/struct-field-assignability.rs +++ b/src/test/run-pass/struct-field-assignability.rs @@ -1,3 +1,5 @@ +#[feature(managed_boxes)]; + struct Foo<'a> { x: &'a int } diff --git a/src/test/run-pass/type-param-constraints.rs b/src/test/run-pass/type-param-constraints.rs index a1cb0063322..e721a9a96db 100644 --- a/src/test/run-pass/type-param-constraints.rs +++ b/src/test/run-pass/type-param-constraints.rs @@ -10,6 +10,8 @@ // xfail-fast +#[feature(managed_boxes)]; + fn p_foo(_pinned: T) { } fn s_foo(_shared: T) { } fn u_foo(_unique: T) { } diff --git a/src/test/run-pass/unique-assign-generic.rs b/src/test/run-pass/unique-assign-generic.rs index eb2638f2568..8fb2b9b40f4 100644 --- a/src/test/run-pass/unique-assign-generic.rs +++ b/src/test/run-pass/unique-assign-generic.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + fn f(t: T) -> T { let t1 = t; t1 diff --git a/src/test/run-pass/unique-copy-box.rs b/src/test/run-pass/unique-copy-box.rs index d84ebe0ba76..48a49996aee 100644 --- a/src/test/run-pass/unique-copy-box.rs +++ b/src/test/run-pass/unique-copy-box.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; #[allow(unused_variable)]; use std::managed; diff --git a/src/test/run-pass/unwind-box.rs b/src/test/run-pass/unwind-box.rs index 2b3e44a6529..173919608de 100644 --- a/src/test/run-pass/unwind-box.rs +++ b/src/test/run-pass/unwind-box.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + extern mod extra; use std::task; diff --git a/src/test/run-pass/vec-matching-autoslice.rs b/src/test/run-pass/vec-matching-autoslice.rs index acd1d63a6ed..cd9d9603ffb 100644 --- a/src/test/run-pass/vec-matching-autoslice.rs +++ b/src/test/run-pass/vec-matching-autoslice.rs @@ -1,3 +1,5 @@ +#[feature(managed_boxes)]; + pub fn main() { let x = @[1, 2, 3]; match x { diff --git a/src/test/run-pass/vec-to_str.rs b/src/test/run-pass/vec-to_str.rs index a24ef38b283..16a895f7231 100644 --- a/src/test/run-pass/vec-to_str.rs +++ b/src/test/run-pass/vec-to_str.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[feature(managed_boxes)]; + pub fn main() { assert_eq!((~[0, 1]).to_str(), ~"[0, 1]"); assert_eq!((&[1, 2]).to_str(), ~"[1, 2]");