]> git.lizzy.rs Git - rust.git/blob - src/test/ui/lazy-type-alias-impl-trait/branches.rs
Rollup merge of #98801 - joshtriplett:file-create-new, r=thomcc
[rust.git] / src / test / ui / lazy-type-alias-impl-trait / branches.rs
1 #![feature(type_alias_impl_trait)]
2
3 type Foo = impl std::fmt::Debug;
4
5 fn foo(b: bool) -> Foo {
6     if b {
7         vec![42_i32]
8     } else {
9         std::iter::empty().collect()
10     }
11 }
12
13 type Bar = impl std::fmt::Debug;
14
15 fn bar(b: bool) -> Bar {
16     let x: Bar = if b {
17         vec![42_i32]
18     } else {
19         std::iter::empty().collect()
20         //~^ ERROR  a value of type `Bar` cannot be built from an iterator over elements of type `_`
21     };
22     x
23 }
24
25 fn main() {}