Closed
Description
#![feature(conservative_impl_trait)]
fn split_whitespace(text: &str) -> impl Iterator<Item=&str> {
fn is_not_empty(s: &&str) -> bool {
!s.is_empty()
}
let is_not_empty: fn(&&str) -> bool = is_not_empty; // coerce to fn pointer
fn is_whitespace(c: char) -> bool {
c.is_whitespace()
}
let is_whitespace: fn(char) -> bool = is_whitespace; // coerce to fn pointer
text.split(is_whitespace).filter(is_not_empty)
}
error: internal compiler error: /checkout/src/librustc_typeck/check/mod.rs:1787: escaping regions in predicate Obligation(predicate=Binder(ProjectionPredicate(ProjectionTy { trait_ref: <_ as std::iter::Iterator>, item_name: Item(88) }, &str)),depth=0)
--> kek.rs:3:36
|
3 | fn split_whitespace(text: &str) -> impl Iterator<Item=&str> {
| ^^^^^^^^^^^^^^^^^^^^^^^^
Using explicit lifetimes does not trigger this ICE.