rust/tests/pass/issues/issue-27901.rs

15 lines
293 B
Rust
Raw Normal View History

trait Stream {
type Item;
}
impl<'a> Stream for &'a str {
type Item = u8;
}
2017-08-29 04:32:10 -05:00
fn f<'s>(s: &'s str) -> (&'s str, <&'s str as Stream>::Item) {
(s, 42)
}
fn main() {
let fx = f as for<'t> fn(&'t str) -> (&'t str, <&'t str as Stream>::Item);
assert_eq!(fx("hi"), ("hi", 42));
}