I'm pretty sure this bug is somehow related to the impl trait feature as I was implementing a fn that returns an impl std::iter::Iterator<Item=&Node> for some struct Node. It also seems related to lifetime elision rules, as that is the differentiating factor.
Interestingly, this compiles:
/// Return a left-to-right iterator over this `Node`'s children
pub fn child_iter_left<'l>(&'l self) -> impl std::iter::Iterator<Item = &'l Node> {
self.children_ref().iter()
}
While this does not:
/// Return a left-to-right iterator over this `Node`'s children
pub fn child_iter_left(&self) -> impl std::iter::Iterator<Item = &Node> {
self.children_ref().iter()
}
In fact, when I compile using the latter form, I get an ICE:
I'm pretty sure this bug is somehow related to the
impl trait
feature as I was implementing a fn that returns animpl std::iter::Iterator<Item=&Node>
for some structNode
. It also seems related to lifetime elision rules, as that is the differentiating factor.Interestingly, this compiles:
While this does not:
In fact, when I compile using the latter form, I get an ICE: