File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
src/test/ui/lazy-type-alias-impl-trait Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 11#![ feature( type_alias_impl_trait) ]
22
3- // check-pass
4-
53type Foo = impl std:: fmt:: Debug ;
64
75fn foo ( b : bool ) -> Foo {
@@ -12,4 +10,16 @@ fn foo(b: bool) -> Foo {
1210 }
1311}
1412
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+
1525fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0277]: a value of type `Bar` cannot be built from an iterator over elements of type `_`
2+ --> $DIR/branches.rs:19:28
3+ |
4+ LL | std::iter::empty().collect()
5+ | ^^^^^^^ value of type `Bar` cannot be built from `std::iter::Iterator<Item=_>`
6+ |
7+ = help: the trait `FromIterator<_>` is not implemented for `Bar`
8+ note: required by a bound in `collect`
9+ --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
10+ |
11+ LL | fn collect<B: FromIterator<Self::Item>>(self) -> B
12+ | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect`
13+
14+ error: aborting due to previous error
15+
16+ For more information about this error, try `rustc --explain E0277`.
You can’t perform that action at this time.
0 commit comments