]> git.lizzy.rs Git - rust.git/blob - src/test/ui/type-alias-impl-trait/reveal_local.rs
Auto merge of #95454 - randomicon00:fix95444, r=wesleywiser
[rust.git] / src / test / ui / type-alias-impl-trait / reveal_local.rs
1 #![feature(type_alias_impl_trait)]
2
3 use std::fmt::Debug;
4
5 type Foo = impl Debug;
6 //~^ ERROR cycle detected
7 //~| ERROR cycle detected
8
9 fn is_send<T: Send>() { }
10
11 fn not_good() {
12     // Error: this function does not constrain `Foo` to any particular
13     // hidden type, so it cannot rely on `Send` being true.
14     is_send::<Foo>();
15 }
16
17 fn not_gooder() {
18     // Constrain `Foo = u32`
19     let x: Foo = 22_u32;
20
21     // while we could know this from the hidden type, it would
22     // need extra roundabout logic to support it.
23     is_send::<Foo>();
24 }
25
26 fn main() {}