]> git.proxmox.com Git - rustc.git/blob - src/test/ui/self/arbitrary_self_types_struct.rs
New upstream version 1.41.1+dfsg1
[rustc.git] / src / test / ui / self / arbitrary_self_types_struct.rs
1 // run-pass
2
3 use std::rc::Rc;
4
5 struct Foo {
6 x: i32,
7 y: i32,
8 }
9
10 impl Foo {
11 fn x(self: &Rc<Self>) -> i32 {
12 self.x
13 }
14
15 fn y(self: Rc<Self>) -> i32 {
16 self.y
17 }
18 }
19
20 fn main() {
21 let foo = Rc::new(Foo {x: 3, y: 4});
22 assert_eq!(3, foo.x());
23 assert_eq!(4, foo.y());
24 }