Skip to content

Instantly share code, notes, and snippets.

@scalexm scalexm/
Last active Jul 31, 2018

What would you like to do?
// chalk does not handle outlive requirements for now, so we say that
// `T: 'a` iff `T: Outlives<'a>`
trait Outlives<'a> { }
struct Slice<'a, T> where T: Outlives<'a> { }
// hack for implied outlive requirements: if you have e.g. `&'a T: 'b` then you must have `T: 'b`
// (see
impl<'a, 'b, T> Outlives<'b> for T where Slice<'a, T>: Outlives<'b> { }
trait StreamingIterator {
// if you remove the where clause, then chalk won't accept the impl below
type Item<'a> where <Self as StreamingIterator>::Item<'a>: Outlives<'a>;
struct Stream<T> { }
impl<T> StreamingIterator for Stream<T> {
type Item<'a> = Slice<'a, T>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.