Created
May 27, 2017 01:02
-
-
Save sdleffler/49f2adcb5adcac4398a248addef844e7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
pub fn make_mut<'b>(this: &'b mut RcThunk<'a, T>) -> &'b mut T where T: Clone { | |
// No, moving it into a temp doesn't help. We just have to trust the CSE | |
// pass here. | |
if Rc::get_mut(&mut this.0).is_some() { | |
return &mut **Rc::get_mut(&mut this.0).unwrap(); | |
} | |
let new_rc = Rc::new(Thunk::computed((*this.0).clone())); | |
this.0 = new_rc; | |
RcThunk::get_mut(this).unwrap() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment