about summary refs log tree commit diff
path: root/tests/ui/delegation/generics/impl-to-trait-method.rs
blob: 39e32e2ed15006ea31f0391a58987be5b886962c (plain)
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
35
36
37
38
39
40
41
42
43
44
#![feature(fn_delegation)]
#![allow(incomplete_features)]

mod bounds {
    trait Trait0 {}

    trait Trait1<T> {
        fn foo<U>(&self)
        where
            T: Trait0,
            U: Trait0,
            Self: Trait0,
            //~^ ERROR the trait bound `bounds::S: Trait0` is not satisfied
        {
        }
    }

    struct F;
    impl<T> Trait1<T> for F {}

    struct S(F);

    impl<T> Trait1<T> for S {
        reuse Trait1::<T>::foo { &self.0 }
        //~^ ERROR the trait bound `bounds::F: Trait0` is not satisfied
    }
}

mod unconstrained_parameter {
    trait Trait<T> {
        fn foo(&self) {}
    }

    struct F;
    impl<T> Trait<T> for F {}

    struct S(F);
    impl S {
        reuse Trait::foo { &self.0 }
        //~^ ERROR type annotations needed
    }
}

fn main() {}