Last active
July 31, 2018 20:16
-
-
Save scalexm/e3e4ecefe970a2df861cc158e50c363c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 https://play.rust-lang.org/?gist=3e5410767c6d596ed7c5b2686f9f6ba1&version=stable&mode=debug&edition=2015) | |
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