rust/tests/source/catch.rs

29 lines
364 B
Rust
Raw Normal View History

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