Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 1 Packages Projects Releases Wiki Activity
Files
e53d6dd35bb38b81dff4b00497f4c152e9009499
rust/tests/ui/issues/issue-44216-add-system-time.rs

11 lines
209 B
Rust
Raw Normal View History

Move tests from `test/run-fail` to UI
2020-04-16 15:50:32 +09:00
// run-fail
Relaxed error pattern, and add test for SystemTime as well.
2017-09-10 01:48:43 +08:00
// error-pattern:overflow
Skip tests on emscripten
2020-05-08 00:39:02 +09:00
// ignore-emscripten no processes
Properly detect overflow in Instance +/- Duration. Avoid unchecked cast from `u64` to `i64`. Use `try_into()` for checked cast. (On Unix, cast to `time_t` instead of `i64`.)
2017-09-01 01:16:24 +08:00
Relaxed error pattern, and add test for SystemTime as well.
2017-09-10 01:48:43 +08:00
use std::time::{Duration, SystemTime};
Properly detect overflow in Instance +/- Duration. Avoid unchecked cast from `u64` to `i64`. Use `try_into()` for checked cast. (On Unix, cast to `time_t` instead of `i64`.)
2017-09-01 01:16:24 +08:00
fn main() {
Relaxed error pattern, and add test for SystemTime as well.
2017-09-10 01:48:43 +08:00
let now = SystemTime::now();
Migrate to numeric associated consts
2020-06-02 07:59:11 +00:00
let _ = now + Duration::from_secs(u64::MAX);
Properly detect overflow in Instance +/- Duration. Avoid unchecked cast from `u64` to `i64`. Use `try_into()` for checked cast. (On Unix, cast to `time_t` instead of `i64`.)
2017-09-01 01:16:24 +08:00
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 3465ms Template: 4ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API