diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2018-02-24 15:48:53 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2018-02-25 12:15:05 +0100 |
| commit | 16fb6b082da3c9e8805c86ef56ccfb44adb397a9 (patch) | |
| tree | 3badba265d9f902a42224c78832f8fe2d12f42df /src/librustc_errors | |
| parent | 5747fd6611a77d297d9559f2365a554bd3dd6610 (diff) | |
| download | rust-16fb6b082da3c9e8805c86ef56ccfb44adb397a9.tar.gz rust-16fb6b082da3c9e8805c86ef56ccfb44adb397a9.zip | |
Reduce error codes length when too much are thrown
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/emitter.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 18900de9733..86e77d404ff 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -122,9 +122,12 @@ impl Drop for EmitterWriter { let mut error_codes = self.error_codes.clone().into_iter().collect::<Vec<_>>(); error_codes.sort(); if error_codes.len() > 1 { + let limit = if error_codes.len() > 9 { 9 } else { error_codes.len() }; writeln!(self.dst, - "You've got a few errors: {}", - error_codes.join(", ")).expect("failed to give tips..."); + "You've got a few errors: {}{}", + error_codes[..limit].join(", "), + if error_codes.len() > 9 { "..." } else { "" } + ).expect("failed to give tips..."); writeln!(self.dst, "If you want more information on an error, try using \ \"rustc --explain {}\"", |
