summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2017-09-10 01:48:43 +0800
committerkennytm <kennytm@gmail.com>2017-09-10 12:35:47 +0800
commit4962f9d72528602f70c7017d95063ef93a3c8967 (patch)
treee8d6dbe793c17387f52cdc139480548cf3d2dcfc
parent83d14bda7fe87b37b61904417cfb53f6351b5f3a (diff)
downloadrust-4962f9d72528602f70c7017d95063ef93a3c8967.tar.gz
Relaxed error pattern, and add test for SystemTime as well.
-rw-r--r--src/test/run-fail/issue-44216-add-instant.rs (renamed from src/test/run-fail/issue-44216-add.rs)2
-rw-r--r--src/test/run-fail/issue-44216-add-system-time.rs18
-rw-r--r--src/test/run-fail/issue-44216-sub-instant.rs (renamed from src/test/run-fail/issue-44216-sub.rs)2
-rw-r--r--src/test/run-fail/issue-44216-sub-system-time.rs18
4 files changed, 38 insertions, 2 deletions
diff --git a/src/test/run-fail/issue-44216-add.rs b/src/test/run-fail/issue-44216-add-instant.rs
index 18bacd0459b..e17d23d925a 100644
--- a/src/test/run-fail/issue-44216-add.rs
+++ b/src/test/run-fail/issue-44216-add-instant.rs
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// error-pattern:overflow when
+// error-pattern:overflow
use std::time::{Instant, Duration};
diff --git a/src/test/run-fail/issue-44216-add-system-time.rs b/src/test/run-fail/issue-44216-add-system-time.rs
new file mode 100644
index 00000000000..4a0c9c7d65e
--- /dev/null
+++ b/src/test/run-fail/issue-44216-add-system-time.rs
@@ -0,0 +1,18 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// error-pattern:overflow
+
+use std::time::{Duration, SystemTime};
+
+fn main() {
+ let now = SystemTime::now();
+ let _ = now + Duration::from_secs(u64::max_value());
+}
diff --git a/src/test/run-fail/issue-44216-sub.rs b/src/test/run-fail/issue-44216-sub-instant.rs
index 551401c51bb..6cc38cfec83 100644
--- a/src/test/run-fail/issue-44216-sub.rs
+++ b/src/test/run-fail/issue-44216-sub-instant.rs
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// error-pattern:overflow when
+// error-pattern:overflow
use std::time::{Instant, Duration};
diff --git a/src/test/run-fail/issue-44216-sub-system-time.rs b/src/test/run-fail/issue-44216-sub-system-time.rs
new file mode 100644
index 00000000000..bcf60126f0f
--- /dev/null
+++ b/src/test/run-fail/issue-44216-sub-system-time.rs
@@ -0,0 +1,18 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// error-pattern:overflow
+
+use std::time::{Duration, SystemTime};
+
+fn main() {
+ let now = SystemTime::now();
+ let _ = now - Duration::from_secs(u64::max_value());
+}