mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 18:53:39 +00:00
18 lines
375 B
Rust
18 lines
375 B
Rust
//@ known-bug: unknown
|
|
#![allow(unused)]
|
|
|
|
struct A(u32);
|
|
|
|
pub fn main() {
|
|
// The or-pattern bindings are lowered after `x`, which triggers the error.
|
|
let x @ (A(a) | A(a)) = A(10);
|
|
// ERROR: use of moved value
|
|
assert!(x.0 == 10);
|
|
assert!(a == 10);
|
|
|
|
// This works.
|
|
let (x @ A(a) | x @ A(a)) = A(10);
|
|
assert!(x.0 == 10);
|
|
assert!(a == 10);
|
|
}
|