rust/src/test/ui/self/suggest-self-2.rs

23 lines
534 B
Rust
Raw Normal View History

struct Foo {}
impl Foo {
fn foo(&self) {
bar(self);
//~^ ERROR cannot find function `bar` in this scope
//~| HELP try calling method instead of passing `self` as parameter
bar(&self);
//~^ ERROR cannot find function `bar` in this scope
//~| HELP try calling method instead of passing `self` as parameter
bar();
//~^ ERROR cannot find function `bar` in this scope
self.bar();
//~^ ERROR no method named `bar` found for type
}
}
fn main() {}