about summary refs log tree commit diff
path: root/compiler/rustc_driver_impl/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-10-18 07:45:56 +0000
committerbors <bors@rust-lang.org>2023-10-18 07:45:56 +0000
commit6d7160ce97f4bbbd44991a7325077e08214e0ce2 (patch)
treef4ca2be81b256dc20def8dd79bd285f84d2ce945 /compiler/rustc_driver_impl/src
parentb9832e72c9223f4e96049aa5911effd258b92591 (diff)
parente1aa5adc786d0579802785190ee561add3e53eb7 (diff)
downloadrust-6d7160ce97f4bbbd44991a7325077e08214e0ce2.tar.gz
rust-6d7160ce97f4bbbd44991a7325077e08214e0ce2.zip
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.
Diffstat (limited to 'compiler/rustc_driver_impl/src')
-rw-r--r--compiler/rustc_driver_impl/src/lib.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs
index ab18cc32d9b..7e4a7d93210 100644
--- a/compiler/rustc_driver_impl/src/lib.rs
+++ b/compiler/rustc_driver_impl/src/lib.rs
@@ -62,7 +62,6 @@ use std::str;
 use std::sync::atomic::{AtomicBool, Ordering};
 use std::sync::OnceLock;
 use std::time::{Instant, SystemTime};
-use time::format_description::well_known::Rfc3339;
 use time::OffsetDateTime;
 
 #[allow(unused_macros)]
@@ -1311,7 +1310,13 @@ fn ice_path() -> &'static Option<PathBuf> {
             None => std::env::current_dir().unwrap_or_default(),
         };
         let now: OffsetDateTime = SystemTime::now().into();
-        let file_now = now.format(&Rfc3339).unwrap_or_default();
+        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(),
+            )
+            .unwrap_or_default();
         let pid = std::process::id();
         path.push(format!("rustc-ice-{file_now}-{pid}.txt"));
         Some(path)