make time format parsing compiletime

This commit is contained in:
klensy 2024-11-02 15:20:11 +03:00
parent be3a635fe7
commit bc1d8e72e7
2 changed files with 3 additions and 3 deletions

View File

@ -49,7 +49,7 @@ rustc_trait_selection = { path = "../rustc_trait_selection" }
rustc_ty_utils = { path = "../rustc_ty_utils" } rustc_ty_utils = { path = "../rustc_ty_utils" }
serde_json = "1.0.59" serde_json = "1.0.59"
shlex = "1.0" shlex = "1.0"
time = { version = "0.3.36", default-features = false, features = ["alloc", "formatting", "parsing", "macros"] } time = { version = "0.3.36", default-features = false, features = ["alloc", "formatting", "macros"] }
tracing = { version = "0.1.35" } tracing = { version = "0.1.35" }
# tidy-alphabetical-end # tidy-alphabetical-end

View File

@ -64,6 +64,7 @@ use rustc_span::source_map::FileLoader;
use rustc_target::json::ToJson; use rustc_target::json::ToJson;
use rustc_target::spec::{Target, TargetTuple}; use rustc_target::spec::{Target, TargetTuple};
use time::OffsetDateTime; use time::OffsetDateTime;
use time::macros::format_description;
use tracing::trace; use tracing::trace;
#[allow(unused_macros)] #[allow(unused_macros)]
@ -1356,8 +1357,7 @@ fn ice_path_with_config(config: Option<&UnstableOptions>) -> &'static Option<Pat
let file_now = now let file_now = now
.format( .format(
// Don't use a standard datetime format because Windows doesn't support `:` in paths // Don't use a standard datetime format because Windows doesn't support `:` in paths
&time::format_description::parse("[year]-[month]-[day]T[hour]_[minute]_[second]") &format_description!("[year]-[month]-[day]T[hour]_[minute]_[second]"),
.unwrap(),
) )
.unwrap_or_default(); .unwrap_or_default();
let pid = std::process::id(); let pid = std::process::id();