Add more tests
This commit is contained in:
parent
524d2b3178
commit
77e88a7c7a
@ -1,7 +1,5 @@
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
// check-pass
|
||||
|
||||
type Foo = impl std::fmt::Debug;
|
||||
|
||||
fn foo(b: bool) -> Foo {
|
||||
@ -12,4 +10,16 @@ fn foo(b: bool) -> Foo {
|
||||
}
|
||||
}
|
||||
|
||||
type Bar = impl std::fmt::Debug;
|
||||
|
||||
fn bar(b: bool) -> Bar {
|
||||
let x: Bar = if b {
|
||||
vec![42_i32]
|
||||
} else {
|
||||
std::iter::empty().collect()
|
||||
//~^ ERROR a value of type `Bar` cannot be built from an iterator over elements of type `_`
|
||||
};
|
||||
x
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
16
src/test/ui/lazy-type-alias-impl-trait/branches.stderr
Normal file
16
src/test/ui/lazy-type-alias-impl-trait/branches.stderr
Normal file
@ -0,0 +1,16 @@
|
||||
error[E0277]: a value of type `Bar` cannot be built from an iterator over elements of type `_`
|
||||
--> $DIR/branches.rs:19:28
|
||||
|
|
||||
LL | std::iter::empty().collect()
|
||||
| ^^^^^^^ value of type `Bar` cannot be built from `std::iter::Iterator<Item=_>`
|
||||
|
|
||||
= help: the trait `FromIterator<_>` is not implemented for `Bar`
|
||||
note: required by a bound in `collect`
|
||||
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
|
||||
|
|
||||
LL | fn collect<B: FromIterator<Self::Item>>(self) -> B
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
Loading…
Reference in New Issue
Block a user