GATs unable to determine if item will live long enough when combined with HRTBs #88683
Labels
A-GATs
Area: Generic associated types (GATs)
C-bug
Category: This is a bug.
F-generic_associated_types
`#![feature(generic_associated_types)]` a.k.a. GATs
(I'm not sure whether this is a diagnostics issue or a bug in the way Generic Associated Types are implemented)
Following this comment on the user forums, I was wondering if it's possible to create a trait which encapsulates the convention that
(&foo).into_iter()
is equivalent tofoo.iter()
.This is what I came up with:
(playground)
Which generates this output:
Here I've already said
type Iterator<'a> where I: 'a
, yet it seems like the compiler isn't able to prove thatI
will live long enough so it suggests adding anotherI: 'a
to the trait bound. I tried usingtype Iterator<'a> where I: 'a, I: 'a, ..., I: 'a
like the compiler suggestsMeta
This was done on the playground using
rustc
version:The text was updated successfully, but these errors were encountered: