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
51b51b51d7931da85280382a81c4dd80c73ca754
rust/tests/ui/issues/issue-44216-sub-system-time.rs

11 lines
198 B
Rust
Raw Normal View History

[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives
2024-02-16 20:02:50 +00:00
//@ run-fail
//@ error-pattern:overflow
tests: use `needs-subprocess` instead of `ignore-{wasm32,emscripten,sgx}`
2025-01-23 16:36:54 +08:00
//@ needs-subprocess
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: 2216ms Template: 2ms
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