mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 03:33:59 +00:00
54 lines
955 B
Rust
54 lines
955 B
Rust
|
//@ edition: 2021
|
||
|
|
||
|
struct Foo(u8);
|
||
|
|
||
|
fn main() {
|
||
|
let Foo(a) = Foo(0);
|
||
|
a = 42; //~ ERROR [E0384]
|
||
|
|
||
|
let Foo(mut a) = Foo(0);
|
||
|
a = 42;
|
||
|
|
||
|
let Foo(ref a) = Foo(0);
|
||
|
a = &42; //~ ERROR [E0384]
|
||
|
|
||
|
let Foo(mut ref a) = Foo(0);
|
||
|
a = &42;
|
||
|
|
||
|
let Foo(ref mut a) = Foo(0);
|
||
|
a = &mut 42; //~ ERROR [E0384]
|
||
|
|
||
|
let Foo(mut ref mut a) = Foo(0);
|
||
|
a = &mut 42;
|
||
|
|
||
|
let Foo(a) = &Foo(0);
|
||
|
a = &42; //~ ERROR [E0384]
|
||
|
|
||
|
let Foo(mut a) = &Foo(0);
|
||
|
a = 42;
|
||
|
|
||
|
let Foo(ref a) = &Foo(0);
|
||
|
a = &42; //~ ERROR [E0384]
|
||
|
|
||
|
let Foo(mut ref a) = &Foo(0);
|
||
|
a = &42;
|
||
|
|
||
|
let Foo(a) = &mut Foo(0);
|
||
|
a = &mut 42; //~ ERROR [E0384]
|
||
|
|
||
|
let Foo(mut a) = &mut Foo(0);
|
||
|
a = 42;
|
||
|
|
||
|
let Foo(ref a) = &mut Foo(0);
|
||
|
a = &42; //~ ERROR [E0384]
|
||
|
|
||
|
let Foo(mut ref a) = &mut Foo(0);
|
||
|
a = &42;
|
||
|
|
||
|
let Foo(ref mut a) = &mut Foo(0);
|
||
|
a = &mut 42; //~ ERROR [E0384]
|
||
|
|
||
|
let Foo(mut ref mut a) = &mut Foo(0);
|
||
|
a = &mut 42;
|
||
|
}
|