]> git.lizzy.rs Git - rust.git/blob - src/test/ui/methods/assign-to-method.rs
move an `assert!` to the right place
[rust.git] / src / test / ui / methods / assign-to-method.rs
1 // compile-flags: -Zsave-analysis
2 // Also regression test for #69409
3
4 struct Cat {
5     meows : usize,
6     how_hungry : isize,
7 }
8
9 impl Cat {
10     pub fn speak(&self) { self.meows += 1; }
11 }
12
13 fn cat(in_x : usize, in_y : isize) -> Cat {
14     Cat {
15         meows: in_x,
16         how_hungry: in_y
17     }
18 }
19
20 fn main() {
21     let nyan : Cat = cat(52, 99);
22     nyan.speak = || println!("meow"); //~ ERROR attempted to take value of method
23     nyan.speak += || println!("meow"); //~ ERROR attempted to take value of method
24 }