Guest User

Untitled

a guest
May 20th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. // Fails to compile (E0495)
  2. fn bar1<'a>(x: &'a mut [i32]) -> impl Fn() -> &'a mut i32 {
  3. || &mut x[0]
  4. }
  5.  
  6. struct Foo<'a>(&'a mut i32);
  7.  
  8. // Compiles
  9. fn bar2<'a>(x: &'a mut [i32]) -> Foo<'a> {
  10. Foo(&mut x[0])
  11. }
  12.  
  13. // Compiles
  14. fn bar3<'a>(x: &'a mut [i32]) -> &'a mut i32 {
  15. &mut x[0]
  16. }
Add Comment
Please, Sign In to add comment