]> git.lizzy.rs Git - rust.git/blob - src/test/ui/type-alias-impl-trait/not_a_defining_use.rs
f29b980dfd0e578e0177ea2a574c3d18ff6b1c2d
[rust.git] / src / test / ui / type-alias-impl-trait / not_a_defining_use.rs
1 #![feature(type_alias_impl_trait)]
2
3 use std::fmt::Debug;
4
5 fn main() {}
6
7 type Two<T, U> = impl Debug;
8
9 fn two<T: Debug>(t: T) -> Two<T, u32> {
10     //~^ ERROR non-defining opaque type use in defining scope
11     (t, 4i8)
12 }
13
14 fn three<T: Debug, U>(t: T) -> Two<T, U> {
15     (t, 5i8)
16 }
17
18 trait Bar {
19     type Blub: Debug;
20     const FOO: Self::Blub;
21 }
22
23 impl Bar for u32 {
24     type Blub = i32;
25     const FOO: i32 = 42;
26 }
27
28 fn four<T: Debug, U: Bar>(t: T) -> Two<T, U> {
29     (t, <U as Bar>::FOO)
30 }
31
32 fn is_sync<T: Sync>() {}
33
34 fn asdfl() {
35     //FIXME(oli-obk): these currently cause cycle errors
36     //is_sync::<Two<i32, u32>>();
37     //is_sync::<Two<i32, *const i32>>();
38 }