about summary refs log tree commit diff
path: root/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.rs
blob: a9cae611ec55e3898917df47983134c59c949362 (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
#![feature(impl_trait_in_assoc_type)]

// We weren't checking that the trait and impl generics line up in the
// normalization-shortcut code in `OpaqueTypeCollector`.

use std::ops::Deref;

trait Foo {
    type Bar<'a>;

    type Baz<'a>;

    fn test<'a>() -> Self::Bar<'a>;
}

impl Foo for () {
    type Bar<'a> = impl Deref<Target = Self::Baz<'a>>;

    type Baz<T> = impl Sized;
    //~^ ERROR type `Baz` has 1 type parameter but its trait declaration has 0 type parameters
    //~| ERROR: unconstrained opaque type

    fn test<'a>() -> Self::Bar<'a> {
        &()
    }
}

fn main() {}