rust/tests/ui/pattern/feature-gate-mut_preserve_binding_mode_2024.rs
2024-04-15 23:27:21 -04:00

15 lines
249 B
Rust

//@ edition: 2024
//@ compile-flags: -Zunstable-options
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
}