mirror of
https://github.com/rust-lang/rust
synced 2024-10-14 12:33:57 +00:00
17 lines
348 B
Rust
17 lines
348 B
Rust
//@ edition: 2021
|
|
#![feature(mut_preserve_binding_mode_2024)]
|
|
#![allow(incomplete_features, unused)]
|
|
#![forbid(dereferencing_mut_binding)]
|
|
|
|
struct Foo(u8);
|
|
|
|
fn main() {
|
|
let Foo(mut a) = &Foo(0);
|
|
//~^ ERROR: dereferencing `mut` binding
|
|
a = 42;
|
|
|
|
let Foo(mut a) = &mut Foo(0);
|
|
//~^ ERROR: dereferencing `mut` binding
|
|
a = 42;
|
|
}
|