rust/tests/ui/rust-2018/try-macro.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
375 B
Rust
Raw Normal View History

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