@@ -236,14 +236,6 @@ where
236236
237237/// The default panic handler.
238238fn 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 > ) {
247239 // If this is a double panic, make sure that we print a backtrace
248240 // for this panic. Otherwise only print it if logging is enabled.
249241 let backtrace = if info. force_no_backtrace ( ) {
@@ -267,7 +259,7 @@ pub fn panic_hook_with_disk_dump(info: &PanicInfo<'_>, path: Option<&crate::path
267259 let thread = thread_info:: current_thread ( ) ;
268260 let name = thread. as_ref ( ) . and_then ( |t| t. name ( ) ) . unwrap_or ( "<unnamed>" ) ;
269261
270- let write = |err : & mut dyn crate :: io:: Write , backtrace : Option < BacktraceStyle > | {
262+ let write = |err : & mut dyn crate :: io:: Write | {
271263 let _ = writeln ! ( err, "thread '{name}' panicked at {location}:\n {msg}" ) ;
272264
273265 static FIRST_PANIC : AtomicBool = AtomicBool :: new ( true ) ;
@@ -281,37 +273,23 @@ pub fn panic_hook_with_disk_dump(info: &PanicInfo<'_>, path: Option<&crate::path
281273 }
282274 Some ( BacktraceStyle :: Off ) => {
283275 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 \
294279 backtrace"
295- ) ;
296- }
280+ ) ;
297281 }
298282 }
299283 // If backtraces aren't supported or are forced-off, do nothing.
300284 None => { }
301285 }
302286 } ;
303287
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-
310288 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 ( ) ) ) ;
312290 set_output_capture ( Some ( local) ) ;
313291 } else if let Some ( mut out) = panic_output ( ) {
314- write ( & mut out, backtrace ) ;
292+ write ( & mut out) ;
315293 }
316294}
317295
0 commit comments