1
Fork 0

auto merge of #10932 : alexcrichton/rust/feature-update, r=cmr

This commit is contained in:
bors 2013-12-14 23:02:15 -08:00
commit 7f5787ac26
108 changed files with 241 additions and 21 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 {
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) {

View file

@ -770,9 +770,21 @@ fn check_heap_type(cx: &Context, span: Span, ty: ty::t) {
let mut n_uniq = 0;
ty::fold_ty(cx.tcx, ty, |t| {
match ty::get(t).sty {
ty::ty_box(_) => n_box += 1,
ty::ty_uniq(_) => n_uniq += 1,
_ => ()
ty::ty_box(_) | ty::ty_estr(ty::vstore_box) |
ty::ty_evec(_, ty::vstore_box) |
ty::ty_trait(_, _, ty::BoxTraitStore, _, _) => {
n_box += 1;
}
ty::ty_uniq(_) | ty::ty_estr(ty::vstore_uniq) |
ty::ty_evec(_, ty::vstore_uniq) |
ty::ty_trait(_, _, ty::UniqTraitStore, _, _) => {
n_uniq += 1;
}
ty::ty_closure(ref c) if c.sigil == ast::OwnedSigil => {
n_uniq += 1;
}
_ => ()
};
t
});

View file

@ -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

View file

@ -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,

View file

@ -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 {

View file

@ -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() {

View file

@ -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

View file

@ -19,6 +19,20 @@ struct Foo {
struct Bar { x: ~int } //~ ERROR type uses owned
fn main() {
let _x : Bar = Bar {x : ~10};
let _x : Bar = Bar {x : ~10}; //~ ERROR type uses owned
@2; //~ ERROR type uses managed
@[1]; //~ ERROR type uses managed
//~^ ERROR type uses managed
fn f(_: @Clone) {} //~ ERROR type uses managed
@""; //~ ERROR type uses managed
//~^ ERROR type uses managed
~2; //~ ERROR type uses owned
~[1]; //~ ERROR type uses owned
//~^ ERROR type uses owned
fn g(_: ~Clone) {} //~ ERROR type uses owned
~""; //~ ERROR type uses owned
//~^ ERROR type uses owned
proc() {}; //~ ERROR type uses owned
}

View file

@ -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<A> { f: A }
fn guard(_s: ~str) -> bool {fail!()}
fn touch<A>(_a: &A) {}

View file

@ -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() {

View file

@ -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;

View file

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

View file

@ -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:Send>(_i: T) {
}

View file

@ -45,6 +45,7 @@
// debugger:print *unique_val_interior_ref_2
// check:$10 = 26.5
#[feature(managed_boxes)];
#[allow(unused_variable)];
struct SomeStruct {

View file

@ -24,6 +24,7 @@
// debugger:print d->val
// check:$4 = false
#[feature(managed_boxes)];
#[allow(unused_variable)];
fn main() {

View file

@ -27,6 +27,7 @@
// debugger:print managed_dtor->val
// check:$4 = {x = 33, y = 333, z = 3333, w = 33333}
#[feature(managed_boxes)];
#[allow(unused_variable)];
struct StructWithSomePadding {

View file

@ -125,6 +125,7 @@
// debugger:print *nn
// check:$43 = 56
#[feature(managed_boxes)];
#[allow(unused_variable)];
struct Struct {

View file

@ -94,6 +94,8 @@
// check:$21 = {-16, 16.5}
// debugger:continue
#[feature(managed_boxes)];
struct Struct<T> {
x: T
}

View file

@ -25,7 +25,7 @@
// check:$3 = {-9747455}
#[allow(unused_variable)];
#[feature(struct_variant)];
#[feature(struct_variant, managed_boxes)];
// 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

View file

@ -94,6 +94,7 @@
// check:$21 = -16
// debugger:continue
#[feature(managed_boxes)];
#[feature(struct_variant)];
enum Enum {

View file

@ -94,6 +94,8 @@
// check:$21 = -16
// debugger:continue
#[feature(managed_boxes)];
struct Struct<T> {
x: T
}

View file

@ -94,6 +94,8 @@
// check:$21 = -16
// debugger:continue
#[feature(managed_boxes)];
struct Struct {
x: int
}

View file

@ -94,6 +94,8 @@
// check:$21 = -16
// debugger:continue
#[feature(managed_boxes)];
struct Struct {
x: int
}

View file

@ -94,6 +94,8 @@
// check:$21 = -16
// debugger:continue
#[feature(managed_boxes)];
struct TupleStruct(int, f64);
impl TupleStruct {

View file

@ -94,6 +94,8 @@
// check:$21 = -16
// debugger:continue
#[feature(managed_boxes)];
struct Struct {
x: int
}

View file

@ -94,6 +94,8 @@
// check:$21 = {-16, 16.5}
// debugger:continue
#[feature(managed_boxes)];
struct Struct {
x: int
}

View file

@ -49,6 +49,7 @@
// check:$14 = 8
// debugger:continue
#[feature(managed_boxes)];
#[allow(unused_variable)];
struct Struct {

View file

@ -28,6 +28,7 @@
// debugger:print managed->val
// check:$6 = 7
#[feature(managed_boxes)];
#[allow(unused_variable)];
struct Struct {

View file

@ -12,6 +12,8 @@
// previously ambiguous (e.g. 'if true { } *val;' gets parsed as a
// binop)
#[feature(managed_boxes)];
fn test1() { let val = @0; { } *val; }
fn test2() -> int { let val = @0; { } *val }

View file

@ -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];

View file

@ -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
}

View file

@ -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;

View file

@ -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;
}

View file

@ -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];

View file

@ -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;

View file

@ -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;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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() {

View file

@ -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();

View file

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

View file

@ -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

View file

@ -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

View file

@ -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

View file

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

View file

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

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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; }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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;

View file

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

View file

@ -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)
}

View file

@ -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;

View file

@ -1,3 +1,5 @@
#[feature(managed_boxes)];
fn f(x: &int) {
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.
#[feature(managed_boxes)];
fn add(x:&int, y:&int)
{
*x + *y;

View file

@ -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);

View file

@ -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;

View file

@ -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); }

View file

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

View file

@ -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)); }

View file

@ -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 } }; }

View file

@ -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 {

View file

@ -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() {

View file

@ -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() {

View file

@ -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.

View file

@ -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<T>(dst: &mut T, src: T);

View file

@ -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,

View file

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

View file

@ -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 {

View file

@ -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() {

View file

@ -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;

View file

@ -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() {

View file

@ -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(()) => {}

View file

@ -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<T>(obj : T, expected : ~str) {

View file

@ -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

View file

@ -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 }

View file

@ -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 }

View file

@ -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 }

View file

@ -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<int>, baz: int }
pub fn main() {

View file

@ -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;
}

View file

@ -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;

View file

@ -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
}

View file

@ -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]
}

View file

@ -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 }

View file

@ -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() {

View file

@ -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 {

Some files were not shown because too many files have changed in this diff Show more