2018-08-30 14:18:55 +02:00
|
|
|
//@ run-pass
|
2015-10-06 22:45:56 +02:00
|
|
|
|
|
|
|
|
pub struct Foo;
|
|
|
|
|
|
|
|
|
|
pub fn get_foo2<'a>(foo: &'a mut Option<&'a mut Foo>) -> &'a mut Foo {
|
|
|
|
|
match foo {
|
|
|
|
|
// Ensure that this is not considered a move, but rather a reborrow.
|
|
|
|
|
&mut Some(ref mut x) => *x,
|
|
|
|
|
&mut None => panic!(),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
}
|