Skip to content

Commit 74e17b4

Browse files
committed
Use YYYY-MM-DDTHH_MM_SS as datetime format for ICE dump files
Windows paths do not support `:`, so use a datetime format in ICE dump paths that Windows will accept. Fix rust-lang#116809, fix rust-lang#115180.
1 parent f70779b commit 74e17b4

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

compiler/rustc_driver_impl/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2021"
66
[lib]
77

88
[dependencies]
9-
time = { version = "0.3", default-features = false, features = ["formatting", ] }
9+
time = { version = "0.3", default-features = false, features = ["alloc", "formatting"] }
1010
tracing = { version = "0.1.35" }
1111
serde_json = "1.0.59"
1212
rustc_log = { path = "../rustc_log" }

compiler/rustc_driver_impl/src/lib.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ use std::str;
6262
use std::sync::atomic::{AtomicBool, Ordering};
6363
use std::sync::OnceLock;
6464
use std::time::{Instant, SystemTime};
65-
use time::format_description::well_known::Rfc3339;
6665
use time::OffsetDateTime;
6766

6867
#[allow(unused_macros)]
@@ -1306,7 +1305,13 @@ fn ice_path() -> &'static Option<PathBuf> {
13061305
None => std::env::current_dir().unwrap_or_default(),
13071306
};
13081307
let now: OffsetDateTime = SystemTime::now().into();
1309-
let file_now = now.format(&Rfc3339).unwrap_or_default();
1308+
let file_now = now
1309+
.format(
1310+
// Don't use a standard datetime format because Windows doesn't support `:` in paths
1311+
&time::format_description::parse("[year]-[month]-[day]T[hour]_[minute]_[second]")
1312+
.unwrap(),
1313+
)
1314+
.unwrap_or_default();
13101315
let pid = std::process::id();
13111316
path.push(format!("rustc-ice-{file_now}-{pid}.txt"));
13121317
Some(path)

0 commit comments

Comments
 (0)