Change check_loans to use ExprUseVisitor.

This commit is contained in:
Cameron Zwarich 2014-06-06 11:59:33 -07:00
parent 78934b03e3
commit c53d296e12
9 changed files with 226 additions and 233 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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