@@ -18,13 +18,13 @@ use rustc_interface::interface;
1818use rustc_middle:: ty:: TyCtxt ;
1919use rustc_tools_util:: VersionInfo ;
2020
21- use lazy_static:: lazy_static;
2221use std:: borrow:: Cow ;
2322use std:: env;
2423use std:: ops:: Deref ;
2524use std:: panic;
2625use std:: path:: { Path , PathBuf } ;
2726use std:: process:: { exit, Command } ;
27+ use std:: lazy:: SyncLazy ;
2828
2929mod lintlist;
3030
@@ -231,13 +231,11 @@ You can use tool lints to allow or deny lints from your code, eg.:
231231
232232const BUG_REPORT_URL : & str = "https://github.com/rust-lang/rust-clippy/issues/new" ;
233233
234- lazy_static ! {
235- static ref ICE_HOOK : Box <dyn Fn ( & panic:: PanicInfo <' _>) + Sync + Send + ' static > = {
236- let hook = panic:: take_hook( ) ;
237- panic:: set_hook( Box :: new( |info| report_clippy_ice( info, BUG_REPORT_URL ) ) ) ;
238- hook
239- } ;
240- }
234+ static ICE_HOOK : SyncLazy < Box < dyn Fn ( & panic:: PanicInfo < ' _ > ) + Sync + Send + ' static > > = SyncLazy :: new ( || {
235+ let hook = panic:: take_hook ( ) ;
236+ panic:: set_hook ( Box :: new ( |info| report_clippy_ice ( info, BUG_REPORT_URL ) ) ) ;
237+ hook
238+ } ) ;
241239
242240fn report_clippy_ice ( info : & panic:: PanicInfo < ' _ > , bug_report_url : & str ) {
243241 // Invoke our ICE handler, which prints the actual panic message and optionally a backtrace
@@ -296,7 +294,7 @@ fn toolchain_path(home: Option<String>, toolchain: Option<String>) -> Option<Pat
296294
297295pub fn main ( ) {
298296 rustc_driver:: init_rustc_env_logger ( ) ;
299- lazy_static :: initialize ( & ICE_HOOK ) ;
297+ SyncLazy :: force ( & ICE_HOOK ) ;
300298 exit ( rustc_driver:: catch_with_exit_code ( move || {
301299 let mut orig_args: Vec < String > = env:: args ( ) . collect ( ) ;
302300
0 commit comments