rust/src/test/ui/try-on-option.rs

16 lines
228 B
Rust
Raw Normal View History

2017-09-22 10:24:06 -05:00
#![feature(try_trait)]
fn main() {}
fn foo() -> Result<u32, ()> {
let x: Option<u32> = None;
2017-11-20 06:13:27 -06:00
x?; //~ the trait bound
2017-09-22 10:24:06 -05:00
Ok(22)
}
fn bar() -> u32 {
let x: Option<u32> = None;
2017-11-20 06:13:27 -06:00
x?; //~ the `?` operator
2017-09-22 10:24:06 -05:00
22
}