]>
git.proxmox.com Git - rustc.git/blob - tests/ui/issues/issue-18952.rs
1 // This issue tests fn_traits overloading on arity.
5 #![feature(unboxed_closures)]
9 impl Fn
<(isize, isize)> for Foo
{
10 extern "rust-call" fn call(&self, args
: (isize, isize)) -> Self::Output
{
11 println
!("{:?}", args
);
12 (args
.0 + 1, args
.1 + 1)
16 impl FnMut
<(isize, isize)> for Foo
{
17 extern "rust-call" fn call_mut(&mut self, args
: (isize, isize)) -> Self::Output
{
18 println
!("{:?}", args
);
19 (args
.0 + 1, args
.1 + 1)
23 impl FnOnce
<(isize, isize)> for Foo
{
24 type Output
= (isize, isize);
25 extern "rust-call" fn call_once(self, args
: (isize, isize)) -> Self::Output
{
26 println
!("{:?}", args
);
27 (args
.0 + 1, args
.1 + 1)
31 impl Fn
<(isize, isize, isize)> for Foo
{
32 extern "rust-call" fn call(&self, args
: (isize, isize, isize)) -> Self::Output
{
33 println
!("{:?}", args
);
34 (args
.0 + 3, args
.1 + 3, args
.2 + 3)
38 impl FnMut
<(isize, isize, isize)> for Foo
{
39 extern "rust-call" fn call_mut(&mut self, args
: (isize, isize, isize)) -> Self::Output
{
40 println
!("{:?}", args
);
41 (args
.0 + 3, args
.1 + 3, args
.2 + 3)
44 impl FnOnce
<(isize, isize, isize)> for Foo
{
45 type Output
= (isize, isize, isize);
46 extern "rust-call" fn call_once(self, args
: (isize, isize, isize)) -> Self::Output
{
47 println
!("{:?}", args
);
48 (args
.0 + 3, args
.1 + 3, args
.2 + 3)
54 assert_eq
!(foo(1, 1), (2, 2));
55 assert_eq
!(foo(1, 1, 1), (4, 4, 4));