diff options
Diffstat (limited to 'src/test/ui/methods/method-self-arg.rs')
| -rw-r--r-- | src/test/ui/methods/method-self-arg.rs | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/test/ui/methods/method-self-arg.rs b/src/test/ui/methods/method-self-arg.rs deleted file mode 100644 index f738fa19c85..00000000000 --- a/src/test/ui/methods/method-self-arg.rs +++ /dev/null @@ -1,46 +0,0 @@ -// run-pass -// Test method calls with self as an argument - -static mut COUNT: usize = 1; - -#[derive(Copy, Clone)] -struct Foo; - -impl Foo { - fn foo(self, x: &Foo) { - unsafe { COUNT *= 2; } - // Test internal call. - Foo::bar(&self); - Foo::bar(x); - - Foo::baz(self); - Foo::baz(*x); - - Foo::qux(Box::new(self)); - Foo::qux(Box::new(*x)); - } - - fn bar(&self) { - unsafe { COUNT *= 3; } - } - - fn baz(self) { - unsafe { COUNT *= 5; } - } - - fn qux(self: Box<Foo>) { - unsafe { COUNT *= 7; } - } -} - -fn main() { - let x = Foo; - // Test external call. - Foo::bar(&x); - Foo::baz(x); - Foo::qux(Box::new(x)); - - x.foo(&x); - - unsafe { assert_eq!(COUNT, 2*3*3*3*5*5*5*7*7*7); } -} |
