]> git.lizzy.rs Git - rust.git/blob - tests/ui/type-alias-impl-trait/reveal_local.rs
Rollup merge of #107078 - ehuss:invalid_doc_attributes-docs, r=jackh726
[rust.git] / tests / 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
8 fn is_send<T: Send>() { }
9
10 fn not_good() {
11     // Error: this function does not constrain `Foo` to any particular
12     // hidden type, so it cannot rely on `Send` being true.
13     is_send::<Foo>();
14 }
15
16 fn not_gooder() {
17     // Constrain `Foo = u32`
18     let x: Foo = 22_u32;
19
20     // while we could know this from the hidden type, it would
21     // need extra roundabout logic to support it.
22     is_send::<Foo>();
23 }
24
25 fn main() {}