diff --git a/src/test/run-fail/issue-44216-add.rs b/src/test/run-fail/issue-44216-add-instant.rs similarity index 95% rename from src/test/run-fail/issue-44216-add.rs rename to 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 or the MIT license +// , 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 similarity index 95% rename from src/test/run-fail/issue-44216-sub.rs rename to 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 or the MIT license +// , 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()); +}