@@ -62,6 +62,7 @@ struct ClippyWarning {
62
62
column : String ,
63
63
linttype : String ,
64
64
message : String ,
65
+ ice : bool ,
65
66
}
66
67
67
68
impl std:: fmt:: Display for ClippyWarning {
@@ -209,8 +210,8 @@ impl Crate {
209
210
let output_lines = stdout. lines ( ) ;
210
211
let warnings: Vec < ClippyWarning > = output_lines
211
212
. into_iter ( )
212
- // get all clippy warnings
213
- . filter ( |line| line. contains ( "clippy::" ) )
213
+ // get all clippy warnings and ICEs
214
+ . filter ( |line| line. contains ( "clippy::" ) || line . contains ( "internal compiler error: " ) )
214
215
. map ( |json_msg| parse_json_message ( json_msg, & self ) )
215
216
. collect ( ) ;
216
217
warnings
@@ -306,6 +307,7 @@ fn parse_json_message(json_message: &str, krate: &Crate) -> ClippyWarning {
306
307
. into ( ) ,
307
308
linttype : jmsg[ "message" ] [ "code" ] [ "code" ] . to_string ( ) . trim_matches ( '"' ) . into ( ) ,
308
309
message : jmsg[ "message" ] [ "message" ] . to_string ( ) . trim_matches ( '"' ) . into ( ) ,
310
+ ice : json_message. contains ( "internal compiler error: " ) ,
309
311
}
310
312
}
311
313
@@ -372,6 +374,13 @@ pub fn run(clap_config: &ArgMatches) {
372
374
373
375
// generate some stats:
374
376
377
+ // grab crashes/ICEs, save the crate name and the ice message
378
+ let ices: Vec < ( & String , & String ) > = clippy_warnings
379
+ . iter ( )
380
+ . filter ( |warning| warning. ice )
381
+ . map ( |w| ( & w. crate_name , & w. message ) )
382
+ . collect ( ) ;
383
+
375
384
// count lint type occurrences
376
385
let mut counter: HashMap < & String , usize > = HashMap :: new ( ) ;
377
386
clippy_warnings
@@ -397,6 +406,10 @@ pub fn run(clap_config: &ArgMatches) {
397
406
// save the text into lintcheck-logs/logs.txt
398
407
let mut text = clippy_ver; // clippy version number on top
399
408
text. push_str ( & format ! ( "\n {}" , all_msgs. join( "" ) ) ) ;
409
+ text. push_str ( "ICEs:\n " ) ;
410
+ ices. iter ( )
411
+ . for_each ( |( cratename, msg) | text. push_str ( & format ! ( "{}: '{}'" , cratename, msg) ) ) ;
412
+
400
413
let file = format ! ( "lintcheck-logs/{}_logs.txt" , filename) ;
401
414
write ( file, text) . unwrap ( ) ;
402
415
}
0 commit comments