Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e928e94

Browse files
committedApr 18, 2019
Auto merge of #60046 - euclio:missing-error-code-descriptions, r=estebank
hide `--explain` hint if error has no extended info Fixes #59848. r? @estebank
2 parents 5d20ff4 + b6f148c commit e928e94

File tree

833 files changed

+563
-936
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

833 files changed

+563
-936
lines changed
 

‎src/librustc_errors/lib.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub use emitter::ColorConfig;
1616
use Level::*;
1717

1818
use emitter::{Emitter, EmitterWriter};
19+
use registry::Registry;
1920

2021
use rustc_data_structures::sync::{self, Lrc, Lock, AtomicUsize, AtomicBool, SeqCst};
2122
use 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 \

‎src/librustc_interface/interface.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ where
111111
crate_name: config.crate_name,
112112
};
113113

114-
let _sess_abort_error = OnDrop(|| compiler.sess.diagnostic().print_error_count());
114+
let _sess_abort_error = OnDrop(|| {
115+
compiler.sess.diagnostic().print_error_count(&util::diagnostics_registry());
116+
});
115117

116118
if compiler.sess.profile_queries() {
117119
profile::begin(&compiler.sess);

0 commit comments

Comments
 (0)
Please sign in to comment.