1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
trait Groom {
fn shave(other: usize);
}
pub struct Cat {
whiskers: isize,
}
pub enum MaybeDog {
Dog,
NoDog
}
impl MaybeDog {
fn bark() {
// If this provides a suggestion, it's a bug as MaybeDog doesn't impl Groom
shave();
//~^ ERROR cannot find function `shave`
}
}
impl Clone for Cat {
fn clone(&self) -> Self {
clone();
//~^ ERROR cannot find function `clone`
loop {}
}
}
impl Default for Cat {
fn default() -> Self {
default();
//~^ ERROR cannot find function `default` in this scope [E0425]
loop {}
}
}
impl Groom for Cat {
fn shave(other: usize) {
whiskers -= other;
//~^ ERROR cannot find value `whiskers`
shave(4);
//~^ ERROR cannot find function `shave`
purr();
//~^ ERROR cannot find function `purr`
}
}
impl Cat {
fn static_method() {}
fn purr_louder() {
static_method();
//~^ ERROR cannot find function `static_method`
purr();
//~^ ERROR cannot find function `purr`
purr();
//~^ ERROR cannot find function `purr`
purr();
//~^ ERROR cannot find function `purr`
}
}
impl Cat {
fn meow() {
if self.whiskers > 3 {
//~^ ERROR expected value, found module `self`
println!("MEOW");
}
}
fn purr(&self) {
grow_older();
//~^ ERROR cannot find function `grow_older`
shave();
//~^ ERROR cannot find function `shave`
}
fn burn_whiskers(&mut self) {
whiskers = 0;
//~^ ERROR cannot find value `whiskers`
}
pub fn grow_older(other:usize) {
whiskers = 4;
//~^ ERROR cannot find value `whiskers`
purr_louder();
//~^ ERROR cannot find function `purr_louder`
}
}
fn main() {
self += 1;
//~^ ERROR expected value, found module `self`
}
|