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