@@ -16,6 +16,7 @@ pub use emitter::ColorConfig;
1616use Level :: * ;
1717
1818use emitter:: { Emitter , EmitterWriter } ;
19+ use registry:: Registry ;
1920
2021use rustc_data_structures:: sync:: { self , Lrc , Lock , AtomicUsize , AtomicBool , SeqCst } ;
2122use rustc_data_structures:: fx:: FxHashSet ;
@@ -651,7 +652,7 @@ impl Handler {
651652 self . err_count ( ) > 0
652653 }
653654
654- pub fn print_error_count ( & self ) {
655+ pub fn print_error_count ( & self , registry : & Registry ) {
655656 let s = match self . err_count ( ) {
656657 0 => return ,
657658 1 => "aborting due to previous error" . to_string ( ) ,
@@ -666,19 +667,22 @@ impl Handler {
666667 let can_show_explain = self . emitter . borrow ( ) . should_show_explain ( ) ;
667668 let are_there_diagnostics = !self . emitted_diagnostic_codes . borrow ( ) . is_empty ( ) ;
668669 if can_show_explain && are_there_diagnostics {
669- let mut error_codes =
670- self . emitted_diagnostic_codes . borrow ( )
671- . iter ( )
672- . filter_map ( |x| match * x {
673- DiagnosticId :: Error ( ref s) => Some ( s. clone ( ) ) ,
674- _ => None ,
675- } )
676- . collect :: < Vec < _ > > ( ) ;
670+ let mut error_codes = self
671+ . emitted_diagnostic_codes
672+ . borrow ( )
673+ . iter ( )
674+ . filter_map ( |x| match & x {
675+ DiagnosticId :: Error ( s) if registry. find_description ( s) . is_some ( ) => {
676+ Some ( s. clone ( ) )
677+ }
678+ _ => None ,
679+ } )
680+ . collect :: < Vec < _ > > ( ) ;
677681 if !error_codes. is_empty ( ) {
678682 error_codes. sort ( ) ;
679683 if error_codes. len ( ) > 1 {
680684 let limit = if error_codes. len ( ) > 9 { 9 } else { error_codes. len ( ) } ;
681- self . failure ( & format ! ( "Some errors occurred : {}{}" ,
685+ self . failure ( & format ! ( "Some errors have detailed explanations : {}{}" ,
682686 error_codes[ ..limit] . join( ", " ) ,
683687 if error_codes. len( ) > 9 { "..." } else { "." } ) ) ;
684688 self . failure ( & format ! ( "For more information about an error, try \
0 commit comments