rust/tests/source/catch.rs

29 lines
364 B
Rust
Raw Normal View History

// rustfmt-edition: 2018
#![feature(try_blocks)]
2017-05-13 00:28:48 +02:00
fn main() {
let x = try {
2017-05-13 00:28:48 +02:00
foo()?
};
let x = try /* Invisible comment */ { foo()? };
2017-05-13 00:28:48 +02:00
let x = try {
2017-05-13 00:28:48 +02:00
unsafe { foo()? }
};
let y = match (try {
2017-05-13 00:28:48 +02:00
foo()?
}) {
_ => (),
};
try {
2017-05-13 00:28:48 +02:00
foo()?;
};
try {
// Regular try block
2017-05-13 00:28:48 +02:00
};
}