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

26 lines
629 B
Rust
Raw Normal View History

struct Foo {}
impl Foo {
fn foo(&self) {
bar(self);
//~^ ERROR cannot find function `bar` in this scope
2019-12-09 09:05:45 -06:00
//~| HELP try calling `bar` as a method
2019-12-09 09:05:45 -06:00
bar(&&self, 102);
//~^ ERROR cannot find function `bar` in this scope
//~| HELP try calling `bar` as a method
2019-12-09 09:05:45 -06:00
bar(&mut self, 102, &"str");
//~^ ERROR cannot find function `bar` in this scope
2019-12-09 09:05:45 -06:00
//~| HELP try calling `bar` as a method
bar();
//~^ ERROR cannot find function `bar` in this scope
self.bar();
//~^ ERROR no method named `bar` found for type
}
}
fn main() {}