diff options
| -rw-r--r-- | src/libcore/macros.rs | 1 | ||||
| -rw-r--r-- | src/libstd/lib.rs | 5 | ||||
| -rw-r--r-- | src/test/ui/associated-types/cache/chrono-scan.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/derived-errors/issue-31997.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/derived-errors/issue-31997.stderr | 6 | ||||
| -rw-r--r-- | src/test/ui/lint/lint-qualification.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/macros/macro-comma-support-rpass.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/macros/try-macro.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/rust-2018/try-macro.fixed | 1 | ||||
| -rw-r--r-- | src/test/ui/rust-2018/try-macro.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/rust-2018/try-macro.stderr | 2 |
11 files changed, 17 insertions, 8 deletions
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 09d2331b60f..ba641f7dc5c 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -300,6 +300,7 @@ macro_rules! debug_assert_ne { /// Ok(()) /// } /// ``` +#[rustc_deprecated(since = "1.38.0", reason = "use the `?` operator instead")] #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] #[doc(alias = "?")] diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index cfee49a7b55..34956fc8394 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -330,7 +330,10 @@ use prelude::v1::*; #[stable(feature = "rust1", since = "1.0.0")] pub use core::{assert_eq, assert_ne, debug_assert, debug_assert_eq, debug_assert_ne}; #[stable(feature = "rust1", since = "1.0.0")] -pub use core::{unreachable, unimplemented, write, writeln, r#try, todo}; +pub use core::{unreachable, unimplemented, write, writeln, todo}; +#[allow(deprecated)] +#[stable(feature = "rust1", since = "1.0.0")] +pub use core::r#try; #[allow(unused_imports)] // macros from `alloc` are not used on all platforms #[macro_use] diff --git a/src/test/ui/associated-types/cache/chrono-scan.rs b/src/test/ui/associated-types/cache/chrono-scan.rs index 8ddd347ff36..5c052405527 100644 --- a/src/test/ui/associated-types/cache/chrono-scan.rs +++ b/src/test/ui/associated-types/cache/chrono-scan.rs @@ -18,7 +18,7 @@ pub fn timezone_offset_zulu<F>(s: &str, colon: F) -> ParseResult<(&str, i32)> pub fn parse<'a, I>(mut s: &str, items: I) -> ParseResult<()> where I: Iterator<Item=Item<'a>> { macro_rules! try_consume { - ($e:expr) => ({ let (s_, v) = try!($e); s = s_; v }) + ($e:expr) => ({ let (s_, v) = $e?; s = s_; v }) } let offset = try_consume!(timezone_offset_zulu(s.trim_start(), colon_or_space)); let offset = try_consume!(timezone_offset_zulu(s.trim_start(), colon_or_space)); diff --git a/src/test/ui/derived-errors/issue-31997.rs b/src/test/ui/derived-errors/issue-31997.rs index cfdee26c559..6d7d21e3673 100644 --- a/src/test/ui/derived-errors/issue-31997.rs +++ b/src/test/ui/derived-errors/issue-31997.rs @@ -10,7 +10,7 @@ fn closure<F, T>(x: F) -> Result<T, ()> } fn foo() -> Result<(), ()> { - try!(closure(|| bar(core::ptr::null_mut()))); //~ ERROR cannot find function `bar` in this scope + closure(|| bar(core::ptr::null_mut()))?; //~ ERROR cannot find function `bar` in this scope Ok(()) } diff --git a/src/test/ui/derived-errors/issue-31997.stderr b/src/test/ui/derived-errors/issue-31997.stderr index e9fe0d3971e..d9260f79f27 100644 --- a/src/test/ui/derived-errors/issue-31997.stderr +++ b/src/test/ui/derived-errors/issue-31997.stderr @@ -1,8 +1,8 @@ error[E0425]: cannot find function `bar` in this scope - --> $DIR/issue-31997.rs:13:21 + --> $DIR/issue-31997.rs:13:16 | -LL | try!(closure(|| bar(core::ptr::null_mut()))); - | ^^^ not found in this scope +LL | closure(|| bar(core::ptr::null_mut()))?; + | ^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/lint/lint-qualification.rs b/src/test/ui/lint/lint-qualification.rs index 2aa4526b816..d458c31dc49 100644 --- a/src/test/ui/lint/lint-qualification.rs +++ b/src/test/ui/lint/lint-qualification.rs @@ -9,7 +9,7 @@ fn main() { foo::bar(); //~ ERROR: unnecessary qualification bar(); - let _ = || -> Result<(), ()> { try!(Ok(())); Ok(()) }; // issue #37345 + let _ = || -> Result<(), ()> { Ok(())?; Ok(()) }; // issue #37345 macro_rules! m { () => { $crate::foo::bar(); // issue #37357 diff --git a/src/test/ui/macros/macro-comma-support-rpass.rs b/src/test/ui/macros/macro-comma-support-rpass.rs index 12a612c153a..17c27b7cda4 100644 --- a/src/test/ui/macros/macro-comma-support-rpass.rs +++ b/src/test/ui/macros/macro-comma-support-rpass.rs @@ -261,7 +261,9 @@ fn thread_local() { #[test] fn try() { fn inner() -> Result<(), ()> { + #[allow(deprecated)] try!(Ok(())); + #[allow(deprecated)] try!(Ok(()),); Ok(()) } diff --git a/src/test/ui/macros/try-macro.rs b/src/test/ui/macros/try-macro.rs index 83b30a8b7ba..64331265449 100644 --- a/src/test/ui/macros/try-macro.rs +++ b/src/test/ui/macros/try-macro.rs @@ -1,4 +1,5 @@ // run-pass +#[allow(deprecated)] use std::num::{ParseFloatError, ParseIntError}; fn main() { diff --git a/src/test/ui/rust-2018/try-macro.fixed b/src/test/ui/rust-2018/try-macro.fixed index 7c1692fd7fb..a7b7d3faf5e 100644 --- a/src/test/ui/rust-2018/try-macro.fixed +++ b/src/test/ui/rust-2018/try-macro.fixed @@ -6,6 +6,7 @@ #![warn(rust_2018_compatibility)] #![allow(unused_variables)] #![allow(dead_code)] +#![allow(deprecated)] fn foo() -> Result<usize, ()> { let x: Result<usize, ()> = Ok(22); diff --git a/src/test/ui/rust-2018/try-macro.rs b/src/test/ui/rust-2018/try-macro.rs index 2089d367be6..986e158eb64 100644 --- a/src/test/ui/rust-2018/try-macro.rs +++ b/src/test/ui/rust-2018/try-macro.rs @@ -6,6 +6,7 @@ #![warn(rust_2018_compatibility)] #![allow(unused_variables)] #![allow(dead_code)] +#![allow(deprecated)] fn foo() -> Result<usize, ()> { let x: Result<usize, ()> = Ok(22); diff --git a/src/test/ui/rust-2018/try-macro.stderr b/src/test/ui/rust-2018/try-macro.stderr index eb65d415064..fad1bb9f1b0 100644 --- a/src/test/ui/rust-2018/try-macro.stderr +++ b/src/test/ui/rust-2018/try-macro.stderr @@ -1,5 +1,5 @@ warning: `try` is a keyword in the 2018 edition - --> $DIR/try-macro.rs:12:5 + --> $DIR/try-macro.rs:13:5 | LL | try!(x); | ^^^ help: you can use a raw identifier to stay compatible: `r#try` |
