@@ -236,14 +236,6 @@ where
236
236
237
237
/// The default panic handler.
238
238
fn default_hook ( info : & PanicInfo < ' _ > ) {
239
- panic_hook_with_disk_dump ( info, None )
240
- }
241
-
242
- #[ unstable( feature = "ice_to_disk" , issue = "none" ) ]
243
- /// The implementation of the default panic handler.
244
- ///
245
- /// It can also write the backtrace to a given `path`. This functionality is used only by `rustc`.
246
- pub fn panic_hook_with_disk_dump ( info : & PanicInfo < ' _ > , path : Option < & crate :: path:: Path > ) {
247
239
// If this is a double panic, make sure that we print a backtrace
248
240
// for this panic. Otherwise only print it if logging is enabled.
249
241
let backtrace = if info. force_no_backtrace ( ) {
@@ -267,7 +259,7 @@ pub fn panic_hook_with_disk_dump(info: &PanicInfo<'_>, path: Option<&crate::path
267
259
let thread = thread_info:: current_thread ( ) ;
268
260
let name = thread. as_ref ( ) . and_then ( |t| t. name ( ) ) . unwrap_or ( "<unnamed>" ) ;
269
261
270
- let write = |err : & mut dyn crate :: io:: Write , backtrace : Option < BacktraceStyle > | {
262
+ let write = |err : & mut dyn crate :: io:: Write | {
271
263
let _ = writeln ! ( err, "thread '{name}' panicked at {location}:\n {msg}" ) ;
272
264
273
265
static FIRST_PANIC : AtomicBool = AtomicBool :: new ( true ) ;
@@ -281,37 +273,23 @@ pub fn panic_hook_with_disk_dump(info: &PanicInfo<'_>, path: Option<&crate::path
281
273
}
282
274
Some ( BacktraceStyle :: Off ) => {
283
275
if FIRST_PANIC . swap ( false , Ordering :: SeqCst ) {
284
- if let Some ( path) = path {
285
- let _ = writeln ! (
286
- err,
287
- "note: a backtrace for this error was stored at `{}`" ,
288
- path. display( ) ,
289
- ) ;
290
- } else {
291
- let _ = writeln ! (
292
- err,
293
- "note: run with `RUST_BACKTRACE=1` environment variable to display a \
276
+ let _ = writeln ! (
277
+ err,
278
+ "note: run with `RUST_BACKTRACE=1` environment variable to display a \
294
279
backtrace"
295
- ) ;
296
- }
280
+ ) ;
297
281
}
298
282
}
299
283
// If backtraces aren't supported or are forced-off, do nothing.
300
284
None => { }
301
285
}
302
286
} ;
303
287
304
- if let Some ( path) = path
305
- && let Ok ( mut out) = crate :: fs:: File :: options ( ) . create ( true ) . append ( true ) . open ( & path)
306
- {
307
- write ( & mut out, BacktraceStyle :: full ( ) ) ;
308
- }
309
-
310
288
if let Some ( local) = set_output_capture ( None ) {
311
- write ( & mut * local. lock ( ) . unwrap_or_else ( |e| e. into_inner ( ) ) , backtrace ) ;
289
+ write ( & mut * local. lock ( ) . unwrap_or_else ( |e| e. into_inner ( ) ) ) ;
312
290
set_output_capture ( Some ( local) ) ;
313
291
} else if let Some ( mut out) = panic_output ( ) {
314
- write ( & mut out, backtrace ) ;
292
+ write ( & mut out) ;
315
293
}
316
294
}
317
295
0 commit comments