2024-04-05 21:18:05 -04:00
|
|
|
//@ edition: 2024
|
2024-12-23 18:38:14 -08:00
|
|
|
//@ revisions: classic structural
|
|
|
|
|
//! Tests for pattern errors not handled by the pattern typing rules, but by borrowck.
|
2024-04-05 21:18:05 -04:00
|
|
|
#![allow(incomplete_features)]
|
2024-12-23 18:38:14 -08:00
|
|
|
#![cfg_attr(classic, feature(ref_pat_eat_one_layer_2024))]
|
|
|
|
|
#![cfg_attr(structural, feature(ref_pat_eat_one_layer_2024_structural))]
|
2024-04-05 21:18:05 -04:00
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
|
if let Some(&Some(x)) = Some(&Some(&mut 0)) {
|
|
|
|
|
//~^ ERROR: cannot move out of a shared reference [E0507]
|
|
|
|
|
let _: &u32 = x;
|
|
|
|
|
}
|
2024-05-04 14:57:27 -04:00
|
|
|
|
|
|
|
|
let &ref mut x = &0;
|
|
|
|
|
//~^ cannot borrow data in a `&` reference as mutable [E0596]
|
2024-04-05 21:18:05 -04:00
|
|
|
}
|