]> git.proxmox.com Git - rustc.git/blame - tests/ui/methods/assign-to-method.rs
New upstream version 1.69.0+dfsg1
[rustc.git] / tests / ui / methods / assign-to-method.rs
CommitLineData
9ffffee4 1// Regression test for #69409
74b04a01
XL
2
3struct Cat {
4 meows : usize,
5 how_hungry : isize,
6}
7
8impl Cat {
9 pub fn speak(&self) { self.meows += 1; }
10}
11
12fn cat(in_x : usize, in_y : isize) -> Cat {
13 Cat {
14 meows: in_x,
15 how_hungry: in_y
16 }
17}
18
19fn main() {
20 let nyan : Cat = cat(52, 99);
21 nyan.speak = || println!("meow"); //~ ERROR attempted to take value of method
22 nyan.speak += || println!("meow"); //~ ERROR attempted to take value of method
23}