about summary refs log tree commit diff
path: root/tests/ui/associated-type-bounds/all-generics-lookup.rs
blob: c5940c14f440c4a406111dd3d29bf2321587fba6 (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
//@ check-pass

#![feature(return_type_notation)]

trait Trait {
    fn method(&self) -> impl Sized;
}

impl Trait for () {
    fn method(&self) -> impl Sized {}
}

struct Struct<T>(T);

// This test used to fail a debug assertion since we weren't resolving the item
// for `T::method(..)` correctly, leading to two bound vars being given the
// index 0. The solution is to look at both generics of `test` and its parent impl.

impl<T> Struct<T>
where
    T: Trait,
{
    fn test()
    where
        T::method(..): Send
    {}
}

fn main() {
    Struct::<()>::test();
}