Skip to content

Commit 6b88403

Browse files
committed
Use chrono instead of time, and permit backtrace
1 parent f8b4a75 commit 6b88403

File tree

4 files changed

+41
-19
lines changed

4 files changed

+41
-19
lines changed

Cargo.lock

+35-3
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,16 @@ dependencies = [
611611
"tracing-tree",
612612
]
613613

614+
[[package]]
615+
name = "chrono"
616+
version = "0.2.25"
617+
source = "registry+https://github.com/rust-lang/crates.io-index"
618+
checksum = "9213f7cd7c27e95c2b57c49f0e69b1ea65b27138da84a170133fd21b07659c00"
619+
dependencies = [
620+
"num",
621+
"time 0.1.43",
622+
]
623+
614624
[[package]]
615625
name = "chrono"
616626
version = "0.4.19"
@@ -2535,7 +2545,7 @@ checksum = "23f3e133c6d515528745ffd3b9f0c7d975ae039f0b6abb099f2168daa2afb4f9"
25352545
dependencies = [
25362546
"ammonia",
25372547
"anyhow",
2538-
"chrono",
2548+
"chrono 0.4.19",
25392549
"clap 3.2.20",
25402550
"clap_complete",
25412551
"elasticlunr-rs",
@@ -2703,6 +2713,17 @@ version = "0.3.0"
27032713
source = "registry+https://github.com/rust-lang/crates.io-index"
27042714
checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be"
27052715

2716+
[[package]]
2717+
name = "num"
2718+
version = "0.1.42"
2719+
source = "registry+https://github.com/rust-lang/crates.io-index"
2720+
checksum = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e"
2721+
dependencies = [
2722+
"num-integer",
2723+
"num-iter",
2724+
"num-traits",
2725+
]
2726+
27062727
[[package]]
27072728
name = "num-integer"
27082729
version = "0.1.43"
@@ -2713,6 +2734,17 @@ dependencies = [
27132734
"num-traits",
27142735
]
27152736

2737+
[[package]]
2738+
name = "num-iter"
2739+
version = "0.1.43"
2740+
source = "registry+https://github.com/rust-lang/crates.io-index"
2741+
checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252"
2742+
dependencies = [
2743+
"autocfg",
2744+
"num-integer",
2745+
"num-traits",
2746+
]
2747+
27162748
[[package]]
27172749
name = "num-traits"
27182750
version = "0.2.12"
@@ -3916,6 +3948,7 @@ name = "rustc_driver"
39163948
version = "0.0.0"
39173949
dependencies = [
39183950
"backtrace",
3951+
"chrono 0.2.25",
39193952
"libc",
39203953
"rustc_ast",
39213954
"rustc_ast_pretty",
@@ -3942,7 +3975,6 @@ dependencies = [
39423975
"rustc_span",
39433976
"rustc_target",
39443977
"serde_json",
3945-
"time 0.3.17",
39463978
"tracing",
39473979
"winapi",
39483980
]
@@ -5252,7 +5284,7 @@ version = "0.5.1"
52525284
source = "registry+https://github.com/rust-lang/crates.io-index"
52535285
checksum = "b3c02f6eb7e7b4100c272f685a9ccaccaab302324e8c7ec3e2ee72340fb29ff3"
52545286
dependencies = [
5255-
"chrono",
5287+
"chrono 0.4.19",
52565288
"log",
52575289
"nom",
52585290
"serde",

compiler/rustc_driver/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ crate-type = ["dylib"]
99
[dependencies]
1010
backtrace = "0.3.66"
1111
serde_json = "1.0.59"
12-
time = { version = "0.3.17", features = ["std", "formatting"] }
12+
chrono = "0.2"
1313
tracing = { version = "0.1.35" }
1414
rustc_log = { path = "../rustc_log" }
1515
rustc_middle = { path = "../rustc_middle" }

compiler/rustc_driver/src/lib.rs

+4-15
Original file line numberDiff line numberDiff line change
@@ -1185,16 +1185,7 @@ pub fn catch_with_exit_code(f: impl FnOnce() -> interface::Result<()>) -> i32 {
11851185
}
11861186

11871187
struct IceError;
1188-
impl From<time::error::InvalidFormatDescription> for IceError {
1189-
fn from(_: time::error::InvalidFormatDescription) -> IceError {
1190-
IceError
1191-
}
1192-
}
1193-
impl From<time::error::Format> for IceError {
1194-
fn from(_: time::error::Format) -> IceError {
1195-
IceError
1196-
}
1197-
}
1188+
11981189
impl From<std::io::Error> for IceError {
11991190
fn from(_: std::io::Error) -> IceError {
12001191
IceError
@@ -1203,11 +1194,9 @@ impl From<std::io::Error> for IceError {
12031194

12041195
fn write_ice_to_disk(info: &panic::PanicInfo<'_>) -> Result<String, IceError> {
12051196
let capture = backtrace::Backtrace::force_capture();
1206-
let now = time::OffsetDateTime::now_utc();
1207-
let format = time::format_description::parse("[year]-[month]-[day]_[hour]:[minute]:[second]")?;
1208-
let file_now = now.format(&format)?;
1209-
let format = time::format_description::parse("[year]-[month]-[day] [hour]:[minute]:[second]")?;
1210-
let now = now.format(&format)?;
1197+
let now = chrono::UTC::now();
1198+
let file_now = now.format("%Y-%m-%d_%H:%M:%S");
1199+
let now = now.format("%Y-%m-%d %H:%M:%S");
12111200
let path = format!("rustc-ice-context-{file_now}.txt");
12121201
let mut file = std::fs::File::create(&path)?;
12131202
writeln!(

src/tools/tidy/src/deps.rs

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
9696
"arrayvec",
9797
"atty",
9898
"autocfg",
99+
"backtrace",
99100
"bitflags",
100101
"block-buffer",
101102
"bumpalo", // Included in Cargo's dep graph but only activated on wasm32-*-unknown.

0 commit comments

Comments
 (0)