Skip to content

Commit

Permalink
make time format parsing compiletime
Browse files Browse the repository at this point in the history
  • Loading branch information
klensy committed Nov 2, 2024
1 parent 7abae78 commit 4eae9b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_driver_impl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ rustc_trait_selection = { path = "../rustc_trait_selection" }
rustc_ty_utils = { path = "../rustc_ty_utils" }
serde_json = "1.0.59"
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" }
# tidy-alphabetical-end

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ use rustc_span::source_map::FileLoader;
use rustc_target::json::ToJson;
use rustc_target::spec::{Target, TargetTriple};
use time::OffsetDateTime;
use time::macros::format_description;
use tracing::trace;

#[allow(unused_macros)]
Expand Down Expand Up @@ -1355,8 +1356,7 @@ fn ice_path_with_config(config: Option<&UnstableOptions>) -> &'static Option<Pat
let file_now = now
.format(
// 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]")
.unwrap(),
&format_description!("[year]-[month]-[day]T[hour]_[minute]_[second]"),
)
.unwrap_or_default();
let pid = std::process::id();
Expand Down

0 comments on commit 4eae9b1

Please sign in to comment.