Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![feature(nll)]
- use std::cell::UnsafeCell;
- use std::rc::Rc;
- type Invariant<T> = UnsafeCell<T>;
- type Covariant<T> = T;
- type Wrapper<T> = Invariant<T>;
- //type Wrapper<T> = Covariant<T>;
- trait AsSelf<'slf> {
- type Ref: ?Sized;
- fn as_self(&'slf self) -> &Self::Ref;
- }
- struct Foo<'a>(Wrapper<&'a str>);
- impl<'slf, 'd: 'slf> AsSelf<'slf> for Foo<'d> {
- type Ref = Foo<'slf>;
- fn as_self(&'slf self) -> &Self::Ref {
- self
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement