Closed
Description
#![feature(existential_type)]
struct Baz<'a> {
source: &'a str,
}
trait Foo<'a> {
type T: Iterator<Item = Baz<'a>> + 'a;
fn foo(source: &'a str) -> Self::T;
}
struct Bar;
impl<'a> Foo<'a> for Bar {
existential type T: Iterator<Item = Baz<'a>> + 'a;
fn foo(source: &'a str) -> Self::T {
std::iter::once(Baz { source })
}
}
Errors:
Compiling playground v0.0.1 (/playground)
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> src/lib.rs:15:5
|
15 | existential type T: Iterator<Item = Baz<'a>> + 'a;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: hidden type `std::iter::Once<Baz<'a>>` captures the lifetime 'a as defined on the impl at 14:6
--> src/lib.rs:14:6
|
14 | impl<'a> Foo<'a> for Bar {
| ^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0700`.
error: Could not compile `playground`.
To learn more, run the command again with --verbose.
May be related to #42940, but I'm not entirely sure.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done