]> git.lizzy.rs Git - rust.git/blob - src/test/ui/assign-to-method.rs
Auto merge of #60065 - QuietMisdreavus:async-move-doctests, r=ollie27
[rust.git] / src / test / ui / assign-to-method.rs
1 struct Cat {
2   meows : usize,
3
4   how_hungry : isize,
5 }
6
7 impl Cat {
8     pub fn speak(&self) { self.meows += 1; }
9 }
10
11 fn cat(in_x : usize, in_y : isize) -> Cat {
12     Cat {
13         meows: in_x,
14         how_hungry: in_y
15     }
16 }
17
18 fn main() {
19   let nyan : Cat = cat(52, 99);
20   nyan.speak = || println!("meow"); //~ ERROR attempted to take value of method
21   nyan.speak += || println!("meow"); //~ ERROR attempted to take value of method
22 }