Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. // tries to narrow `'static` to `'a`
  2. struct Narrowing<'a> {
  3. covariant: &'a (),
  4. }
  5.  
  6. impl<'a> Foo<'a> {
  7. fn smaller(v: &mut &'a i32) {}
  8.  
  9. fn bigger(v: &mut &'static i32) {
  10. Self::smaller(v)
  11. }
  12. }
  13.  
  14. // tries to widen `'a` to `'static`
  15. struct Widening<'a> {
  16. covariant: &'a (),
  17. }
  18.  
  19. impl<'a> Widening<'a> {
  20. fn smaller(v: &mut &'a i32) {
  21. Self::bigger(v)
  22. }
  23.  
  24. fn bigger(v: &mut &'static i32) {}
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement