These are chat archives for rust-lang/rust

Aug 2015
John C F
Aug 10 2015 10:11
This message was deleted
Igor Khomenko
Aug 10 2015 14:58
is Weak the same as not mutable reference?
Andy Russell
Aug 10 2015 21:12
how can I cast an Option<&mut SomeStruct> to Option<&SomeStruct>?
Erik Hedvall
Aug 10 2015 21:44

This is one way of doing it:

let mut s = SomeStruct;
let x = Some(&mut s).map(|s| s as &_);

I'm quite sure the call to map will be optimized away, or at least be aggressively inlined.