2021-10-17 00:42:22 -05:00
|
|
|
// from rfc2005 test suite
|
|
|
|
|
2022-02-27 00:08:31 -06:00
|
|
|
|
2021-10-17 00:42:22 -05:00
|
|
|
|
|
|
|
// Verify the binding mode shifts - only when no `&` are auto-dereferenced is the
|
|
|
|
// final default binding mode mutable.
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let Some(n): &mut Option<i32> = &&Some(5i32) else { return }; //~ ERROR mismatched types
|
|
|
|
*n += 1;
|
|
|
|
let _ = n;
|
|
|
|
|
|
|
|
let Some(n): &mut Option<i32> = &&mut Some(5i32) else { return }; //~ ERROR mismatched types
|
|
|
|
*n += 1;
|
|
|
|
let _ = n;
|
|
|
|
}
|