rust/tests/ui/pattern/mut_preserve_binding_mode_2021.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
324 B
Rust
Raw Normal View History

//@ edition: 2021
//@ compile-flags: -Zunstable-options
2024-04-14 11:12:52 -04:00
#![feature(mut_preserve_binding_mode_2024)]
2024-04-14 13:33:11 -04:00
#![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
}