@@ -16,6 +16,7 @@ pub use emitter::ColorConfig;
16
16
use Level :: * ;
17
17
18
18
use emitter:: { Emitter , EmitterWriter } ;
19
+ use registry:: Registry ;
19
20
20
21
use rustc_data_structures:: sync:: { self , Lrc , Lock , AtomicUsize , AtomicBool , SeqCst } ;
21
22
use rustc_data_structures:: fx:: FxHashSet ;
@@ -651,7 +652,7 @@ impl Handler {
651
652
self . err_count ( ) > 0
652
653
}
653
654
654
- pub fn print_error_count ( & self ) {
655
+ pub fn print_error_count ( & self , registry : & Registry ) {
655
656
let s = match self . err_count ( ) {
656
657
0 => return ,
657
658
1 => "aborting due to previous error" . to_string ( ) ,
@@ -666,19 +667,22 @@ impl Handler {
666
667
let can_show_explain = self . emitter . borrow ( ) . should_show_explain ( ) ;
667
668
let are_there_diagnostics = !self . emitted_diagnostic_codes . borrow ( ) . is_empty ( ) ;
668
669
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 < _ > > ( ) ;
677
681
if !error_codes. is_empty ( ) {
678
682
error_codes. sort ( ) ;
679
683
if error_codes. len ( ) > 1 {
680
684
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 : {}{}" ,
682
686
error_codes[ ..limit] . join( ", " ) ,
683
687
if error_codes. len( ) > 9 { "..." } else { "." } ) ) ;
684
688
self . failure ( & format ! ( "For more information about an error, try \
0 commit comments