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