File: custom_trait_bound_invalid.rs

package info (click to toggle)
rust-impl-trait-for-tuples 0.2.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 352 kB
  • sloc: makefile: 2
file content (34 lines) | stat: -rw-r--r-- 602 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
trait Test {
    type Arg;

    fn test(arg: Self::Arg);
}

trait Custom {
    type NewArg;

    fn new_test(arg: Self::NewArg);
}

#[impl_trait_for_tuples::impl_for_tuples(5)]
#[tuple_types_custom_trait_bound(Custom, Clone)]
impl Test for Tuple {
    for_tuples!( type Arg = ( #( Tuple::NewArg ),* ); );
    fn test(arg: Self::Arg) {
        for_tuples!( #( Tuple::new_test(arg.Tuple); )* );
    }
}

struct Impl;

impl Custom for Impl {
    type NewArg = ();

    fn new_test(_arg: Self::NewArg) {}
}

fn test<T: Test>() {}
fn main() {
    test::<(Impl, Impl)>();
    test::<(Impl, Impl, Impl)>();
}