mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-22 03:44:24 +00:00
test: Fix some compile-fail bustage. rs=bustage
This commit is contained in:
parent
b27150ef82
commit
45052e13a5
@ -2,7 +2,7 @@ fn main() {
|
||||
let x = Some(~1);
|
||||
match x { //~ NOTE loan of immutable local variable granted here
|
||||
Some(ref _y) => {
|
||||
let _a = move x; //~ ERROR moving out of immutable local variable prohibited due to outstanding loan
|
||||
let _a = x; //~ ERROR moving out of immutable local variable prohibited due to outstanding loan
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ fn main() {
|
||||
let x = Some(~1);
|
||||
match x {
|
||||
Some(ref y) => {
|
||||
let _b = move *y; //~ ERROR moving out of dereference of immutable & pointer
|
||||
let _b = *y; //~ ERROR moving out of dereference of immutable & pointer
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
fn take(-_v: ~int) {
|
||||
fn take(_v: ~int) {
|
||||
}
|
||||
|
||||
fn box_imm() {
|
||||
let v = ~3;
|
||||
let _w = &v; //~ NOTE loan of immutable local variable granted here
|
||||
take(move v); //~ ERROR moving out of immutable local variable prohibited due to outstanding loan
|
||||
take(v); //~ ERROR moving out of immutable local variable prohibited due to outstanding loan
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -4,7 +4,7 @@ struct Point {
|
||||
}
|
||||
|
||||
impl Point : ops::Add<int,int> {
|
||||
pure fn add(z: &int) -> int {
|
||||
pure fn add(&self, z: &int) -> int {
|
||||
self.x + self.y + (*z)
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ fn main() {
|
||||
// Create a cycle!
|
||||
match *x { //~ NOTE loan of immutable local variable granted here
|
||||
node(ref y) => {
|
||||
y.a = move x; //~ ERROR moving out of immutable local variable prohibited due to outstanding loan
|
||||
y.a = x; //~ ERROR moving out of immutable local variable prohibited due to outstanding loan
|
||||
}
|
||||
empty => {}
|
||||
};
|
||||
|
@ -18,5 +18,5 @@ enum wrapper = noncopyable;
|
||||
|
||||
fn main() {
|
||||
let x1 = wrapper(noncopyable());
|
||||
let _x2 = move *x1; //~ ERROR moving out of enum content
|
||||
let _x2 = *x1; //~ ERROR moving out of enum content
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
fn foo(+x: ~int) -> int {
|
||||
let y = &*x; //~ NOTE loan of argument granted here
|
||||
free(move x); //~ ERROR moving out of argument prohibited due to outstanding loan
|
||||
free(x); //~ ERROR moving out of argument prohibited due to outstanding loan
|
||||
*y
|
||||
}
|
||||
|
||||
@ -8,4 +8,4 @@ fn free(+_x: ~int) {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +0,0 @@
|
||||
#[legacy_modes];
|
||||
|
||||
fn foo<T: Copy>(+_t: T) { fail; }
|
||||
|
||||
fn bar<T>(+_t: T) { fail; }
|
||||
|
||||
struct S {
|
||||
x: int,
|
||||
}
|
||||
|
||||
impl S : Drop {
|
||||
fn finalize(&self) {}
|
||||
}
|
||||
|
||||
fn S(x: int) -> S { S { x: x } }
|
||||
|
||||
impl S : Add<S, S> {
|
||||
pure fn add(rhs: &S) -> S {
|
||||
S { x: self.x + (*rhs).x }
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let v = S(5);
|
||||
let _y = v + (move v); //~ ERROR: copying a noncopyable value
|
||||
}
|
@ -10,7 +10,7 @@ trait parse {
|
||||
|
||||
impl parser: parse {
|
||||
fn parse() -> ~[int] {
|
||||
dvec::unwrap(move self.tokens) //~ ERROR moving out of immutable field
|
||||
dvec::unwrap(self.tokens) //~ ERROR moving out of immutable field
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user