]> git.proxmox.com Git - rustc.git/blob - tests/ui/methods/assign-to-method.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / 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 }