about summary refs log tree commit diff
path: root/tests/ui/pattern/mut_preserve_binding_mode_2021.rs
blob: 282e0ef95d2244c93508ed2641db8fdf966451f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//@ edition: 2021
//@ compile-flags: -Zunstable-options
#![feature(ref_pat_eat_one_layer_2024)]
#![allow(incomplete_features)]

struct Foo(u8);

fn main() {
    let Foo(mut a) = &Foo(0);
    a = &42;
    //~^ ERROR: mismatched types

    let Foo(mut a) = &mut Foo(0);
    a = &mut 42;
    //~^ ERROR: mismatched types
}