mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
22 lines
481 B
Rust
22 lines
481 B
Rust
// run-pass
|
|
|
|
fn main() {
|
|
let value = Some(1);
|
|
assert_eq!(match value {
|
|
ref a @ Some(_) => a,
|
|
ref b @ None => b
|
|
}, &Some(1));
|
|
assert_eq!(match value {
|
|
ref c @ Some(_) => c,
|
|
ref b @ None => b
|
|
}, &Some(1));
|
|
assert_eq!(match "foobarbaz" {
|
|
b @ _ => b
|
|
}, "foobarbaz");
|
|
let a @ _ = "foobarbaz";
|
|
assert_eq!(a, "foobarbaz");
|
|
let value = Some(true);
|
|
let ref a @ _ = value;
|
|
assert_eq!(a, &Some(true));
|
|
}
|