Files
rust/tests/ui/reborrow/reborrow-mutable-reference.rs
ujjwalVishwakarma2006 bcf86daada Add issue links
2026-04-15 23:50:36 +05:30

16 lines
358 B
Rust

//! Regression test for <https://github.com/rust-lang/rust/issues/28839>
//@ run-pass
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() {
}