about summary refs log tree commit diff
path: root/tests/ui/impl-trait/in-trait/false-positive-predicate-entailment-error.rs
blob: cbe6c32b8901cf156af9b2a1497cc2dd89d24570 (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
45
46
47
48
49
50
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@[next] check-pass

trait MyFn<T> {
    type Output;
}

trait Callback<A>: MyFn<A, Output = Self::Ret> {
    type Ret;
}

impl<A, F: MyFn<A>> Callback<A> for F {
    type Ret = F::Output;
}

struct Thing;
trait Trait {}
impl Trait for Thing {}

trait ChannelSender {
    type CallbackArg;

    fn autobatch<F>(self) -> impl Trait
    where
        F: Callback<Self::CallbackArg>;
        //[current]~^ ERROR the trait bound `F: Callback<i32>` is not satisfied
}

struct Sender;

impl ChannelSender for Sender {
    type CallbackArg = i32;

    fn autobatch<F>(self) -> impl Trait
    //[current]~^ ERROR the trait bound `F: MyFn<i32>` is not satisfied
    //[current]~| ERROR the trait bound `F: MyFn<i32>` is not satisfied
    //[current]~| ERROR the trait bound `F: MyFn<i32>` is not satisfied
    //[current]~| ERROR the trait bound `F: MyFn<i32>` is not satisfied
    where
        F: Callback<Self::CallbackArg>,
        //[current]~^ ERROR the trait bound `F: MyFn<i32>` is not satisfied
        //[current]~| ERROR the trait bound `F: Callback<i32>` is not satisfied
        {
        Thing
    }
}

fn main() {}