Change check_loans to use ExprUseVisitor.
This commit is contained in:
parent
78934b03e3
commit
c53d296e12
9 changed files with 226 additions and 233 deletions
|
|
@ -16,6 +16,6 @@ struct point {
|
|||
|
||||
fn main() {
|
||||
let mut origin: point;
|
||||
origin = point {x: 10,.. origin}; //~ ERROR use of possibly uninitialized variable: `origin`
|
||||
origin = point {x: 10,.. origin}; //~ ERROR use of possibly uninitialized variable: `origin.y`
|
||||
origin.clone();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,6 @@ extern crate debug;
|
|||
fn main() {
|
||||
let x = box 5;
|
||||
let y = x;
|
||||
println!("{:?}", *x); //~ ERROR use of moved value: `x`
|
||||
println!("{:?}", *x); //~ ERROR use of partially moved value: `*x`
|
||||
y.clone();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,12 +17,6 @@ struct Foo { f: String, y: int }
|
|||
fn consume(_s: String) {}
|
||||
fn touch<A>(_a: &A) {}
|
||||
|
||||
fn f10() {
|
||||
let x = Foo { f: "hi".to_string(), y: 3 };
|
||||
consume(x.f);
|
||||
touch(&x.y); //~ ERROR use of partially moved value: `x`
|
||||
}
|
||||
|
||||
fn f20() {
|
||||
let x = vec!("hi".to_string());
|
||||
consume(x.move_iter().next().unwrap());
|
||||
|
|
|
|||
|
|
@ -26,13 +26,7 @@ fn test0(f: Foo, g: Noncopyable, h: Noncopyable) {
|
|||
fn test1(f: Foo, g: Noncopyable, h: Noncopyable) {
|
||||
// copying move-by-default fields from `f`, so move:
|
||||
let _b = Foo {noncopyable: g, ..f};
|
||||
let _c = Foo {noncopyable: h, ..f}; //~ ERROR use of partially moved value: `f`
|
||||
}
|
||||
|
||||
fn test2(f: Foo, g: Noncopyable) {
|
||||
// move non-copyable field
|
||||
let _b = Foo {copied: 22, moved: box 23, ..f};
|
||||
let _c = Foo {noncopyable: g, ..f}; //~ ERROR use of partially moved value: `f`
|
||||
let _c = Foo {noncopyable: h, ..f}; //~ ERROR use of moved value: `f.moved`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ impl Drop for S {
|
|||
impl S {
|
||||
pub fn foo(self) -> int {
|
||||
self.bar();
|
||||
return self.x; //~ ERROR use of moved value: `self`
|
||||
return self.x; //~ ERROR use of partially moved value: `self.x`
|
||||
}
|
||||
|
||||
pub fn bar(self) {}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ struct S {
|
|||
impl S {
|
||||
pub fn foo(self) -> int {
|
||||
self.bar();
|
||||
return *self.x; //~ ERROR use of moved value: `self`
|
||||
return *self.x; //~ ERROR use of partially moved value: `*self.x`
|
||||
}
|
||||
|
||||
pub fn bar(self) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue