]> git.lizzy.rs Git - rust.git/commitdiff
Allow deprecated try macro in test crates
authorLzu Tao <taolzu@gmail.com>
Sun, 14 Jul 2019 08:16:46 +0000 (08:16 +0000)
committerLzu Tao <taolzu@gmail.com>
Fri, 9 Aug 2019 02:29:44 +0000 (02:29 +0000)
src/test/ui/associated-types/cache/chrono-scan.rs
src/test/ui/derived-errors/issue-31997.rs
src/test/ui/derived-errors/issue-31997.stderr
src/test/ui/lint/lint-qualification.rs
src/test/ui/lint/lint-qualification.stderr
src/test/ui/macros/macro-comma-support-rpass.rs
src/test/ui/macros/try-macro.rs

index 5c05240552761c0d3484ae4296c2af62eae4f878..964ddc9b625deb52b2a1c794c23a7b96c917ed0b 100644 (file)
@@ -1,5 +1,7 @@
 // check-pass
 
+#![allow(deprecated)]
+
 pub type ParseResult<T> = Result<T, ()>;
 
 pub enum Item<'a> {
@@ -18,7 +20,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) = $e?; s = s_; v })
+        ($e:expr) => ({ let (s_, v) = try!($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));
index 6d7d21e367322034daa545eaa7eb43379fb65dd0..ff619313afb5be53f227836ef027f2254adb8dda 100644 (file)
@@ -1,5 +1,6 @@
 // Test that the resolve failure does not lead to downstream type errors.
 // See issue #31997.
+#![allow(deprecated)]
 
 trait TheTrait { }
 
@@ -10,7 +11,7 @@ fn closure<F, T>(x: F) -> Result<T, ()>
 }
 
 fn foo() -> Result<(), ()> {
-    closure(|| bar(core::ptr::null_mut()))?; //~ ERROR cannot find function `bar` in this scope
+    try!(closure(|| bar(core::ptr::null_mut()))); //~ ERROR cannot find function `bar` in this scope
     Ok(())
 }
 
index d9260f79f27423500996e0d576221f7048b64af8..b53c0cda8de4de3f14bf91351ff566faf64593bf 100644 (file)
@@ -1,8 +1,8 @@
 error[E0425]: cannot find function `bar` in this scope
-  --> $DIR/issue-31997.rs:13:16
+  --> $DIR/issue-31997.rs:14:21
    |
-LL |     closure(|| bar(core::ptr::null_mut()))?;
-   |                ^^^ not found in this scope
+LL |     try!(closure(|| bar(core::ptr::null_mut())));
+   |                     ^^^ not found in this scope
 
 error: aborting due to previous error
 
index d458c31dc4926797cb969dd4182fb93a6389394c..1b24191a111c2b051322709afdcbc324a76648de 100644 (file)
@@ -1,4 +1,5 @@
 #![deny(unused_qualifications)]
+#[allow(deprecated)]
 
 mod foo {
     pub fn bar() {}
@@ -9,7 +10,7 @@ fn main() {
     foo::bar(); //~ ERROR: unnecessary qualification
     bar();
 
-    let _ = || -> Result<(), ()> { Ok(())?; Ok(()) }; // issue #37345
+    let _ = || -> Result<(), ()> { try!(Ok(())); Ok(()) }; // issue #37345
 
     macro_rules! m { () => {
         $crate::foo::bar(); // issue #37357
index 78f7e32a30cd19a2f48dd9392bcc1a6ac2a4e7b2..125aeb3db0366761c561c1ad8a171ea3ab45828c 100644 (file)
@@ -1,5 +1,5 @@
 error: unnecessary qualification
-  --> $DIR/lint-qualification.rs:9:5
+  --> $DIR/lint-qualification.rs:10:5
    |
 LL |     foo::bar();
    |     ^^^^^^^^
index 17c27b7cda473cdc1023ea6fd9f4f25a7350939b..50c0ef3451d3d834f5af038eb8bdfd14ef2e2586 100644 (file)
@@ -15,6 +15,7 @@
 
 #![cfg_attr(core, no_std)]
 
+#![allow(deprecated)] // for deprecated `try!()` macro
 #![feature(concat_idents)]
 
 #[cfg(std)] use std::fmt;
@@ -261,9 +262,7 @@ fn thread_local() {
 #[test]
 fn try() {
     fn inner() -> Result<(), ()> {
-        #[allow(deprecated)]
         try!(Ok(()));
-        #[allow(deprecated)]
         try!(Ok(()),);
         Ok(())
     }
index 643312654493ae089d0d570eb4f469075551087d..824c77d9de528ade70a8f5dcc5cd2398c98ec43b 100644 (file)
@@ -1,5 +1,5 @@
 // run-pass
-#[allow(deprecated)]
+#![allow(deprecated)] // for deprecated `try!()` macro
 use std::num::{ParseFloatError, ParseIntError};
 
 fn main() {