@@ -18,13 +18,13 @@ use rustc_interface::interface;
18
18
use rustc_middle:: ty:: TyCtxt ;
19
19
use rustc_tools_util:: VersionInfo ;
20
20
21
- use lazy_static:: lazy_static;
22
21
use std:: borrow:: Cow ;
23
22
use std:: env;
24
23
use std:: ops:: Deref ;
25
24
use std:: panic;
26
25
use std:: path:: { Path , PathBuf } ;
27
26
use std:: process:: { exit, Command } ;
27
+ use std:: lazy:: SyncLazy ;
28
28
29
29
mod lintlist;
30
30
@@ -231,13 +231,11 @@ You can use tool lints to allow or deny lints from your code, eg.:
231
231
232
232
const BUG_REPORT_URL : & str = "https://github.com/rust-lang/rust-clippy/issues/new" ;
233
233
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
+ } ) ;
241
239
242
240
fn report_clippy_ice ( info : & panic:: PanicInfo < ' _ > , bug_report_url : & str ) {
243
241
// 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
296
294
297
295
pub fn main ( ) {
298
296
rustc_driver:: init_rustc_env_logger ( ) ;
299
- lazy_static :: initialize ( & ICE_HOOK ) ;
297
+ SyncLazy :: force ( & ICE_HOOK ) ;
300
298
exit ( rustc_driver:: catch_with_exit_code ( move || {
301
299
let mut orig_args: Vec < String > = env:: args ( ) . collect ( ) ;
302
300
0 commit comments