]> git.lizzy.rs Git - rust.git/blob - src/test/ui/type-alias-impl-trait/fallback.rs
Auto merge of #95454 - randomicon00:fix95444, r=wesleywiser
[rust.git] / src / test / ui / type-alias-impl-trait / fallback.rs
1 // Tests that we correctly handle opaque types being used opaquely,
2 // even within their defining scope.
3 //
4 // check-pass
5 #![feature(type_alias_impl_trait)]
6
7 type Foo = impl Copy;
8
9 enum Wrapper<T> {
10     First(T),
11     Second
12 }
13
14 // This method constrains `Foo` to be `bool`
15 fn constrained_foo() -> Foo {
16     true
17 }
18
19
20 // This method does not constrain `Foo`.
21 // Per RFC 2071, function bodies may either
22 // fully constrain an opaque type, or place no
23 // constraints on it.
24 fn unconstrained_foo() -> Wrapper<Foo> {
25     Wrapper::Second
26 }
27
28 fn main() {}