2021-10-17 00:42:22 -05:00
|
|
|
// Slightly different from explicit-mut-annotated -- this won't show an error until borrowck.
|
|
|
|
// Should it show a type error instead?
|
|
|
|
|
2022-02-27 00:08:31 -06:00
|
|
|
|
|
|
|
|
2021-10-17 00:42:22 -05:00
|
|
|
fn main() {
|
|
|
|
let Some(n): &mut Option<i32> = &mut &Some(5i32) else {
|
|
|
|
//~^ ERROR cannot borrow data in a `&` reference as mutable
|
|
|
|
return
|
|
|
|
};
|
|
|
|
*n += 1;
|
|
|
|
let _ = n;
|
|
|
|
}
|