Closed
Description
The following code fails to compile, but I believe this should be a supported use-case under rust-lang/rfcs#2515 (and #63063):
#![feature(type_alias_impl_trait)]
type X = impl Iterator<Item = u64> + Unpin;
struct Foo(X);
impl Foo {
fn new(z: Vec<u64>) -> Self {
Foo(z.into_iter())
}
}
with
error[E0308]: mismatched types
--> src/lib.rs:12:13
|
12 | Foo(z.into_iter())
| ^^^^^^^^^^^^^ expected opaque type, found struct `std::vec::IntoIter`
|
= note: expected type `X`
found type `std::vec::IntoIter<u64>`
This code on the other hand works just fine with the above X
:
fn foo(z: Vec<u64>) -> X {
z.into_iter()
}
Including both Foo
and foo
in the same file still produces the same error, so foo
does not "help" identify X
.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done