Skip to content

Commit 6d7160c

Browse files
committed
Auto merge of #116814 - estebank:windows-ice-path, r=petrochenkov
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. CC #116809, fix #115180.
2 parents b9832e7 + e1aa5ad commit 6d7160c

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

compiler/rustc_driver_impl/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ rustc_target = { path = "../rustc_target" }
5252
rustc_trait_selection = { path = "../rustc_trait_selection" }
5353
rustc_ty_utils = { path = "../rustc_ty_utils" }
5454
serde_json = "1.0.59"
55-
time = { version = "0.3", default-features = false, features = ["formatting", ] }
55+
time = { version = "0.3", default-features = false, features = ["alloc", "formatting"] }
5656
tracing = { version = "0.1.35" }
5757
# tidy-alphabetical-end
5858

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)]
@@ -1311,7 +1310,13 @@ fn ice_path() -> &'static Option<PathBuf> {
13111310
None => std::env::current_dir().unwrap_or_default(),
13121311
};
13131312
let now: OffsetDateTime = SystemTime::now().into();
1314-
let file_now = now.format(&Rfc3339).unwrap_or_default();
1313+
let file_now = now
1314+
.format(
1315+
// Don't use a standard datetime format because Windows doesn't support `:` in paths
1316+
&time::format_description::parse("[year]-[month]-[day]T[hour]_[minute]_[second]")
1317+
.unwrap(),
1318+
)
1319+
.unwrap_or_default();
13151320
let pid = std::process::id();
13161321
path.push(format!("rustc-ice-{file_now}-{pid}.txt"));
13171322
Some(path)

tests/run-make/dump-ice-to-disk/check.sh

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ export RUSTC_ICE=$TMPDIR
1111
$RUSTC src/lib.rs -Z treat-err-as-bug=1 1>$TMPDIR/rust-test-default-set.log 2>&1
1212
default_set=$(cat $TMPDIR/rustc-ice-*.txt | wc -l)
1313
content=$(cat $TMPDIR/rustc-ice-*.txt)
14+
# Ensure that the ICE dump path doesn't contain `:` because they cause problems on Windows
15+
windows_safe=$(echo rustc-ice-*.txt | grep ':')
16+
if [ ! -z "$windows_safe" ]; then
17+
exit 1
18+
fi
19+
1420
rm $TMPDIR/rustc-ice-*.txt
1521
RUST_BACKTRACE=short $RUSTC src/lib.rs -Z treat-err-as-bug=1 1>$TMPDIR/rust-test-short.log 2>&1
1622
short=$(cat $TMPDIR/rustc-ice-*.txt | wc -l)

0 commit comments

Comments
 (0)