Update/delete tests using @[].
This commit is contained in:
parent
f63c3fba4c
commit
b972cadf61
21 changed files with 9 additions and 128 deletions
|
@ -17,7 +17,7 @@ fn main() {
|
|||
// reference. That would allow creating a mutable pointer to a
|
||||
// temporary, which would be a source of confusion
|
||||
|
||||
let mut a = @[0];
|
||||
let mut a = ~[0];
|
||||
a.test_mut(); //~ ERROR does not implement any method in scope named `test_mut`
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#[feature(managed_boxes)];
|
||||
|
||||
type Foo = @[u8];
|
||||
type Foo = ~[u8];
|
||||
|
||||
impl Drop for Foo { //~ ERROR the Drop trait may only be implemented
|
||||
//~^ ERROR cannot provide an extension implementation
|
||||
|
|
|
@ -10,30 +10,20 @@
|
|||
|
||||
#[feature(managed_boxes)];
|
||||
|
||||
fn wants_box(x: @[uint]) { }
|
||||
fn wants_uniq(x: ~[uint]) { }
|
||||
fn wants_three(x: [uint, ..3]) { }
|
||||
|
||||
fn has_box(x: @[uint]) {
|
||||
wants_box(x);
|
||||
wants_uniq(x); //~ ERROR [] storage differs: expected `~` but found `@`
|
||||
wants_three(x); //~ ERROR [] storage differs: expected `3` but found `@`
|
||||
}
|
||||
|
||||
fn has_uniq(x: ~[uint]) {
|
||||
wants_box(x); //~ ERROR [] storage differs: expected `@` but found `~`
|
||||
wants_uniq(x);
|
||||
wants_three(x); //~ ERROR [] storage differs: expected `3` but found `~`
|
||||
}
|
||||
|
||||
fn has_three(x: [uint, ..3]) {
|
||||
wants_box(x); //~ ERROR [] storage differs: expected `@` but found `3`
|
||||
wants_uniq(x); //~ ERROR [] storage differs: expected `~` but found `3`
|
||||
wants_three(x);
|
||||
}
|
||||
|
||||
fn has_four(x: [uint, ..4]) {
|
||||
wants_box(x); //~ ERROR [] storage differs: expected `@` but found `4`
|
||||
wants_uniq(x); //~ ERROR [] storage differs: expected `~` but found `4`
|
||||
wants_three(x); //~ ERROR [] storage differs: expected `3` but found `4`
|
||||
}
|
||||
|
|
|
@ -11,6 +11,5 @@
|
|||
#[feature(managed_boxes)];
|
||||
|
||||
static x: ~[int] = ~[123, 456]; //~ ERROR: cannot allocate vectors in constant expressions
|
||||
static y: @[int] = @[123, 456]; //~ ERROR: cannot allocate vectors in constant expressions
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -22,8 +22,7 @@ fn main() {
|
|||
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
|
||||
|
||||
~2; //~ ERROR type uses owned
|
||||
|
|
|
@ -72,12 +72,6 @@ fn f80() {
|
|||
touch(&x); //~ ERROR use of moved value: `x`
|
||||
}
|
||||
|
||||
fn f90() {
|
||||
let x = ~"hi";
|
||||
let _y = @[x];
|
||||
touch(&x); //~ ERROR use of moved value: `x`
|
||||
}
|
||||
|
||||
fn f100() {
|
||||
let x = ~[~"hi"];
|
||||
let _y = x[0];
|
||||
|
|
|
@ -17,21 +17,15 @@
|
|||
// debugger:run
|
||||
// debugger:finish
|
||||
|
||||
// debugger:print managed->val.fill
|
||||
// check:$1 = 24
|
||||
// debugger:print *((uint64_t[3]*)(managed->val.elements))
|
||||
// check:$2 = {7, 8, 9}
|
||||
|
||||
// debugger:print unique->fill
|
||||
// check:$3 = 32
|
||||
// check:$1 = 32
|
||||
// debugger:print *((uint64_t[4]*)(unique->elements))
|
||||
// check:$4 = {10, 11, 12, 13}
|
||||
// check:$2 = {10, 11, 12, 13}
|
||||
|
||||
#[allow(unused_variable)];
|
||||
|
||||
fn main() {
|
||||
|
||||
let managed: @[i64] = @[7, 8, 9];
|
||||
let unique: ~[i64] = ~[10, 11, 12, 13];
|
||||
|
||||
zzz();
|
||||
|
|
|
@ -144,9 +144,6 @@ pub fn main() {
|
|||
let a = &Point {x: 3u, y: 5u};
|
||||
test_ebml(a);
|
||||
|
||||
let a = &@[1u, 2u, 3u];
|
||||
test_ebml(a);
|
||||
|
||||
let a = &Top(22u);
|
||||
test_ebml(a);
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ pub fn main() {
|
|||
|
||||
([1]).test_imm();
|
||||
(~[1]).test_imm();
|
||||
(@[1]).test_imm();
|
||||
(&[1]).test_imm();
|
||||
("test").test_imm();
|
||||
(~"test").test_imm();
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// 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; }
|
||||
return sum;
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let x = @[1, 2, 3];
|
||||
assert_eq!(sum_slice(x), 6);
|
||||
}
|
|
@ -7,10 +7,4 @@ pub fn main() {
|
|||
println!("{}", v[2]);
|
||||
println!("{}", v[3]);
|
||||
println!("{}", v[4]);
|
||||
let v: @[int] = @[ 2, ..5 ];
|
||||
println!("{}", v[0]);
|
||||
println!("{}", v[1]);
|
||||
println!("{}", v[2]);
|
||||
println!("{}", v[3]);
|
||||
println!("{}", v[4]);
|
||||
}
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#[feature(managed_boxes)];
|
||||
#[allow(unused_mut)];
|
||||
|
||||
pub fn main() {
|
||||
let mut your_favorite_numbers = @[1,2,3];
|
||||
let mut my_favorite_numbers = @[4,5,6];
|
||||
let f = your_favorite_numbers + my_favorite_numbers;
|
||||
println!("The third favorite number is {:?}.", f)
|
||||
}
|
||||
|
|
@ -35,10 +35,6 @@ pub fn main() {
|
|||
baz: ~[],
|
||||
bar: ~32,
|
||||
};
|
||||
let _t1_at = Thing1 {
|
||||
baz: @[],
|
||||
bar: ~32,
|
||||
};
|
||||
let _t2_fixed = Thing2 {
|
||||
baz: &[],
|
||||
bar: 32,
|
||||
|
@ -47,8 +43,4 @@ pub fn main() {
|
|||
baz: ~[],
|
||||
bar: 32,
|
||||
};
|
||||
let _t2_at = Thing2 {
|
||||
baz: @[],
|
||||
bar: 32,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -80,8 +80,6 @@ pub fn main() {
|
|||
check_type!(@19: @int);
|
||||
check_type!(~"foo": ~str);
|
||||
check_type!(~[20, 22]: ~[int]);
|
||||
check_type!(@[]: @[int]);
|
||||
check_type!(@[24, 26]: @[int]);
|
||||
let mint: uint = unsafe { cast::transmute(main) };
|
||||
check_type!(main: extern fn(), |pthing| {
|
||||
assert!(mint == unsafe { cast::transmute(*pthing) })
|
||||
|
|
|
@ -42,6 +42,5 @@ pub fn main() {
|
|||
check_type!(@int);
|
||||
check_type!(~str);
|
||||
check_type!(~[int]);
|
||||
check_type!(@[int]);
|
||||
check_type!(extern fn());
|
||||
}
|
||||
|
|
|
@ -22,6 +22,6 @@ pub fn main() {
|
|||
|
||||
assert_eq!(mem::size_of::<S<u64, u16>>(), 11);
|
||||
|
||||
assert_eq!(mem::size_of::<S<~str, @[int]>>(),
|
||||
1 + mem::size_of::<~str>() + mem::size_of::<@[int]>());
|
||||
assert_eq!(mem::size_of::<S<~str, ~[int]>>(),
|
||||
1 + mem::size_of::<~str>() + mem::size_of::<~[int]>());
|
||||
}
|
||||
|
|
|
@ -252,9 +252,6 @@ impl<V:TyVisitor + movable_ptr> TyVisitor for ptr_visit_adaptor<V> {
|
|||
}
|
||||
|
||||
fn visit_evec_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
|
||||
self.align_to::<@[u8]>();
|
||||
if ! self.inner().visit_evec_box(mtbl, inner) { return false; }
|
||||
self.bump_past::<@[u8]>();
|
||||
true
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// 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]
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let p = @[22u];
|
||||
let r = foo(p);
|
||||
assert_eq!(r, 22u);
|
||||
}
|
|
@ -16,7 +16,7 @@ struct Foo {
|
|||
}
|
||||
|
||||
pub fn main() {
|
||||
let x = [ @[true], ..512 ];
|
||||
let x = [ [true], ..512 ];
|
||||
let y = [ 0, ..1 ];
|
||||
|
||||
error!("{:?}", x);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#[feature(managed_boxes)];
|
||||
|
||||
pub fn main() {
|
||||
let x = @[1, 2, 3];
|
||||
let x = ~[1, 2, 3];
|
||||
match x {
|
||||
[2, ..] => fail!(),
|
||||
[1, ..tail] => {
|
||||
|
|
|
@ -8,19 +8,13 @@
|
|||
// 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]");
|
||||
assert_eq!((@[2, 3]).to_str(), ~"[2, 3]");
|
||||
|
||||
let foo = ~[3, 4];
|
||||
let bar = &[4, 5];
|
||||
let baz = @[5, 6];
|
||||
|
||||
assert_eq!(foo.to_str(), ~"[3, 4]");
|
||||
assert_eq!(bar.to_str(), ~"[4, 5]");
|
||||
assert_eq!(baz.to_str(), ~"[5, 6]");
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue