mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Rollup merge of #62672 - lzutao:deprecated-try-macro, r=Centril
Deprecate `try!` macro Replaces #62077 Fixes rust-lang/rust-clippy#1361 Fixes #61000
This commit is contained in:
commit
03c524e0f5
@ -302,6 +302,7 @@ macro_rules! debug_assert_ne {
|
||||
/// ```
|
||||
#[macro_export]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_deprecated(since = "1.39.0", reason = "use the `?` operator instead")]
|
||||
#[doc(alias = "?")]
|
||||
macro_rules! r#try {
|
||||
($expr:expr) => (match $expr {
|
||||
|
@ -330,7 +330,11 @@ 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};
|
||||
// FIXME: change this to `#[allow(deprecated)]` when we update nightly compiler.
|
||||
#[allow(deprecated_in_future)]
|
||||
#[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]
|
||||
|
@ -1,5 +1,7 @@
|
||||
// check-pass
|
||||
|
||||
#![allow(deprecated)]
|
||||
|
||||
pub type ParseResult<T> = Result<T, ()>;
|
||||
|
||||
pub enum Item<'a> {
|
||||
|
@ -1,5 +1,6 @@
|
||||
// Test that the resolve failure does not lead to downstream type errors.
|
||||
// See issue #31997.
|
||||
#![allow(deprecated)]
|
||||
|
||||
trait TheTrait { }
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0425]: cannot find function `bar` in this scope
|
||||
--> $DIR/issue-31997.rs:13:21
|
||||
--> $DIR/issue-31997.rs:14:21
|
||||
|
|
||||
LL | try!(closure(|| bar(core::ptr::null_mut())));
|
||||
| ^^^ not found in this scope
|
||||
|
@ -1,4 +1,5 @@
|
||||
#![deny(unused_qualifications)]
|
||||
#[allow(deprecated)]
|
||||
|
||||
mod foo {
|
||||
pub fn bar() {}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: unnecessary qualification
|
||||
--> $DIR/lint-qualification.rs:9:5
|
||||
--> $DIR/lint-qualification.rs:10:5
|
||||
|
|
||||
LL | foo::bar();
|
||||
| ^^^^^^^^
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#![cfg_attr(core, no_std)]
|
||||
|
||||
#![allow(deprecated)] // for deprecated `try!()` macro
|
||||
#![feature(concat_idents)]
|
||||
|
||||
#[cfg(std)] use std::fmt;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// run-pass
|
||||
#![allow(deprecated)] // for deprecated `try!()` macro
|
||||
use std::num::{ParseFloatError, ParseIntError};
|
||||
|
||||
fn main() {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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`
|
||||
|
Loading…
Reference in New Issue
Block a user