about summary refs log tree commit diff
path: root/tests/ui/type-alias-impl-trait/bounds-are-checked3.rs
blob: a8524770a85282af74fcd3cb2d6cfd2e926a6b45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#![feature(type_alias_impl_trait)]

use std::fmt::{Debug, Display};

struct Struct<V: Display>(Option<V>);

// Make sure that, in contrast to type aliases without opaque types,
// we actually do a wf check for the aliased type.
type Foo<T: Debug> = (impl Debug, Struct<T>);
//~^ ERROR: `T` doesn't implement `std::fmt::Display`

#[define_opaque(Foo)]
fn foo<U: Debug + Display>() -> Foo<U> {
    (Vec::<U>::new(), Struct(None))
}

fn main() {}