diff options
| author | bors <bors@rust-lang.org> | 2023-10-18 07:45:56 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-10-18 07:45:56 +0000 |
| commit | 6d7160ce97f4bbbd44991a7325077e08214e0ce2 (patch) | |
| tree | f4ca2be81b256dc20def8dd79bd285f84d2ce945 | |
| parent | b9832e72c9223f4e96049aa5911effd258b92591 (diff) | |
| parent | e1aa5adc786d0579802785190ee561add3e53eb7 (diff) | |
| download | rust-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.
| -rw-r--r-- | compiler/rustc_driver_impl/Cargo.toml | 2 | ||||
| -rw-r--r-- | compiler/rustc_driver_impl/src/lib.rs | 9 | ||||
| -rw-r--r-- | tests/run-make/dump-ice-to-disk/check.sh | 6 |
3 files changed, 14 insertions, 3 deletions
diff --git a/compiler/rustc_driver_impl/Cargo.toml b/compiler/rustc_driver_impl/Cargo.toml index 4894312b0d2..d931a8dab9b 100644 --- a/compiler/rustc_driver_impl/Cargo.toml +++ b/compiler/rustc_driver_impl/Cargo.toml @@ -52,7 +52,7 @@ rustc_target = { path = "../rustc_target" } rustc_trait_selection = { path = "../rustc_trait_selection" } rustc_ty_utils = { path = "../rustc_ty_utils" } serde_json = "1.0.59" -time = { version = "0.3", default-features = false, features = ["formatting", ] } +time = { version = "0.3", default-features = false, features = ["alloc", "formatting"] } tracing = { version = "0.1.35" } # tidy-alphabetical-end 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) diff --git a/tests/run-make/dump-ice-to-disk/check.sh b/tests/run-make/dump-ice-to-disk/check.sh index ab6f9ab6018..ff6e4be35af 100644 --- a/tests/run-make/dump-ice-to-disk/check.sh +++ b/tests/run-make/dump-ice-to-disk/check.sh @@ -11,6 +11,12 @@ export RUSTC_ICE=$TMPDIR $RUSTC src/lib.rs -Z treat-err-as-bug=1 1>$TMPDIR/rust-test-default-set.log 2>&1 default_set=$(cat $TMPDIR/rustc-ice-*.txt | wc -l) content=$(cat $TMPDIR/rustc-ice-*.txt) +# Ensure that the ICE dump path doesn't contain `:` because they cause problems on Windows +windows_safe=$(echo rustc-ice-*.txt | grep ':') +if [ ! -z "$windows_safe" ]; then + exit 1 +fi + rm $TMPDIR/rustc-ice-*.txt RUST_BACKTRACE=short $RUSTC src/lib.rs -Z treat-err-as-bug=1 1>$TMPDIR/rust-test-short.log 2>&1 short=$(cat $TMPDIR/rustc-ice-*.txt | wc -l) |
