Skip to content

Commit 72494e8

Browse files
authored
Rollup merge of rust-lang#60046 - euclio:missing-error-code-descriptions, r=estebank
hide `--explain` hint if error has no extended info Fixes rust-lang#59848. r? @estebank
2 parents b13cf83 + b6f148c commit 72494e8

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);

src/test/ui-fulldeps/hash-stable-is-unstable.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@ LL | #[derive(HashStable)]
4949

5050
error: aborting due to 6 previous errors
5151

52-
Some errors occurred: E0601, E0658.
52+
Some errors have detailed explanations: E0601, E0658.
5353
For more information about an error, try `rustc --explain E0601`.

src/test/ui-fulldeps/macro-crate-rlib.stderr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ LL | #![plugin(rlib_crate_test)]
66

77
error: aborting due to previous error
88

9-
For more information about this error, try `rustc --explain E0457`.

src/test/ui/E0594.ast.nll.stderr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ LL | NUM = 20;
66

77
error: aborting due to previous error
88

9-
For more information about this error, try `rustc --explain E0594`.

src/test/ui/E0594.ast.stderr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ LL | NUM = 20;
66

77
error: aborting due to previous error
88

9-
For more information about this error, try `rustc --explain E0594`.

src/test/ui/E0594.mir.stderr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ LL | NUM = 20;
66

77
error: aborting due to previous error
88

9-
For more information about this error, try `rustc --explain E0594`.

src/test/ui/E0660.stderr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ LL | asm!("nop" "nop" : "=r"(a));
1212

1313
error: aborting due to 2 previous errors
1414

15-
For more information about this error, try `rustc --explain E0660`.

src/test/ui/E0661.stderr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ LL | asm!("nop" : "r"(a));
66

77
error: aborting due to previous error
88

9-
For more information about this error, try `rustc --explain E0661`.

src/test/ui/E0662.stderr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ LL | : "=test"("a")
66

77
error: aborting due to previous error
88

9-
For more information about this error, try `rustc --explain E0662`.

0 commit comments

Comments
 (0)