]> git.proxmox.com Git - rustc.git/blob - src/test/ui/methods/auxiliary/method_self_arg1.rs
New upstream version 1.41.1+dfsg1
[rustc.git] / src / test / ui / methods / auxiliary / method_self_arg1.rs
1 #![crate_type = "lib"]
2
3 #![feature(box_syntax)]
4
5 static mut COUNT: u64 = 1;
6
7 pub fn get_count() -> u64 { unsafe { COUNT } }
8
9 #[derive(Copy, Clone)]
10 pub struct Foo;
11
12 impl Foo {
13 pub fn foo(self, x: &Foo) {
14 unsafe { COUNT *= 2; }
15 // Test internal call.
16 Foo::bar(&self);
17 Foo::bar(x);
18
19 Foo::baz(self);
20 Foo::baz(*x);
21
22 Foo::qux(box self);
23 Foo::qux(box *x);
24 }
25
26 pub fn bar(&self) {
27 unsafe { COUNT *= 3; }
28 }
29
30 pub fn baz(self) {
31 unsafe { COUNT *= 5; }
32 }
33
34 pub fn qux(self: Box<Foo>) {
35 unsafe { COUNT *= 7; }
36 }
37 }