1
Fork 0
rust/src/test/ui/rust-2018/try-macro.rs

19 lines
373 B
Rust
Raw Normal View History

2018-09-10 17:14:30 -04:00
// Test that `try!` macros are rewritten.
// run-rustfix
// check-pass
2018-09-10 17:14:30 -04:00
#![warn(rust_2018_compatibility)]
#![allow(dead_code)]
#![allow(deprecated)]
2018-09-10 17:14:30 -04:00
fn foo() -> Result<usize, ()> {
let x: Result<usize, ()> = Ok(22);
try!(x);
//~^ WARNING `try` is a keyword in the 2018 edition
//~| WARNING this is valid in the current edition
2018-09-10 17:14:30 -04:00
Ok(44)
}
fn main() { }