Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct S {
- a: i32,
- }
- fn main() {
- let s = S { a: 1 };
- fn works(s: &S) -> &i32 { &s.a }
- let a = works(&s);
- // Doesn't
- let borrow: for<'a> fn(&'a S) -> &'a i32 = |s: &S| &s.a;
- let a = borrow(&s);
- }
Add Comment
Please, Sign In to add comment