@@ -21,7 +21,7 @@ use std::io::prelude::*;
2121use std:: io;
2222use std:: rc:: Rc ;
2323use term;
24- use std:: collections:: { HashMap , HashSet } ;
24+ use std:: collections:: HashMap ;
2525use std:: cmp:: min;
2626use unicode_width;
2727
@@ -109,7 +109,6 @@ pub struct EmitterWriter {
109109 cm : Option < Rc < CodeMapper > > ,
110110 short_message : bool ,
111111 teach : bool ,
112- error_codes : HashSet < String > ,
113112 ui_testing : bool ,
114113}
115114
@@ -119,33 +118,6 @@ struct FileWithAnnotatedLines {
119118 multiline_depth : usize ,
120119}
121120
122- impl Drop for EmitterWriter {
123- fn drop ( & mut self ) {
124- if !self . short_message && !self . error_codes . is_empty ( ) {
125- let mut error_codes = self . error_codes . clone ( ) . into_iter ( ) . collect :: < Vec < _ > > ( ) ;
126- error_codes. sort ( ) ;
127- if error_codes. len ( ) > 1 {
128- let limit = if error_codes. len ( ) > 9 { 9 } else { error_codes. len ( ) } ;
129- writeln ! ( self . dst,
130- "You've got a few errors: {}{}" ,
131- error_codes[ ..limit] . join( ", " ) ,
132- if error_codes. len( ) > 9 { "..." } else { "" }
133- ) . expect ( "failed to give tips..." ) ;
134- writeln ! ( self . dst,
135- "If you want more information on an error, try using \
136- \" rustc --explain {}\" ",
137- & error_codes[ 0 ] ) . expect ( "failed to give tips..." ) ;
138- } else {
139- writeln ! ( self . dst,
140- "If you want more information on this error, try using \
141- \" rustc --explain {}\" ",
142- & error_codes[ 0 ] ) . expect ( "failed to give tips..." ) ;
143- }
144- self . dst . flush ( ) . expect ( "failed to emit errors" ) ;
145- }
146- }
147- }
148-
149121impl EmitterWriter {
150122 pub fn stderr ( color_config : ColorConfig ,
151123 code_map : Option < Rc < CodeMapper > > ,
@@ -159,7 +131,6 @@ impl EmitterWriter {
159131 cm : code_map,
160132 short_message,
161133 teach,
162- error_codes : HashSet :: new ( ) ,
163134 ui_testing : false ,
164135 }
165136 } else {
@@ -168,7 +139,6 @@ impl EmitterWriter {
168139 cm : code_map,
169140 short_message,
170141 teach,
171- error_codes : HashSet :: new ( ) ,
172142 ui_testing : false ,
173143 }
174144 }
@@ -184,7 +154,6 @@ impl EmitterWriter {
184154 cm : code_map,
185155 short_message,
186156 teach,
187- error_codes : HashSet :: new ( ) ,
188157 ui_testing : false ,
189158 }
190159 }
@@ -1025,14 +994,12 @@ impl EmitterWriter {
1025994 if primary_span != & & DUMMY_SP {
1026995 ( cm. lookup_char_pos ( primary_span. lo ( ) ) , cm)
1027996 } else {
1028- emit_to_destination ( & buffer. render ( ) , level, & mut self . dst , self . short_message ,
1029- & mut self . error_codes ) ?;
997+ emit_to_destination ( & buffer. render ( ) , level, & mut self . dst , self . short_message ) ?;
1030998 return Ok ( ( ) ) ;
1031999 }
10321000 } else {
10331001 // If we don't have span information, emit and exit
1034- emit_to_destination ( & buffer. render ( ) , level, & mut self . dst , self . short_message ,
1035- & mut self . error_codes ) ?;
1002+ emit_to_destination ( & buffer. render ( ) , level, & mut self . dst , self . short_message ) ?;
10361003 return Ok ( ( ) ) ;
10371004 } ;
10381005 if let Ok ( pos) =
@@ -1205,8 +1172,7 @@ impl EmitterWriter {
12051172 }
12061173
12071174 // final step: take our styled buffer, render it, then output it
1208- emit_to_destination ( & buffer. render ( ) , level, & mut self . dst , self . short_message ,
1209- & mut self . error_codes ) ?;
1175+ emit_to_destination ( & buffer. render ( ) , level, & mut self . dst , self . short_message ) ?;
12101176
12111177 Ok ( ( ) )
12121178
@@ -1294,8 +1260,7 @@ impl EmitterWriter {
12941260 let msg = format ! ( "and {} other candidates" , suggestions. len( ) - MAX_SUGGESTIONS ) ;
12951261 buffer. puts ( row_num, 0 , & msg, Style :: NoStyle ) ;
12961262 }
1297- emit_to_destination ( & buffer. render ( ) , level, & mut self . dst , self . short_message ,
1298- & mut self . error_codes ) ?;
1263+ emit_to_destination ( & buffer. render ( ) , level, & mut self . dst , self . short_message ) ?;
12991264 }
13001265 Ok ( ( ) )
13011266 }
@@ -1326,7 +1291,7 @@ impl EmitterWriter {
13261291 draw_col_separator_no_space ( & mut buffer, 0 , max_line_num_len + 1 ) ;
13271292 }
13281293 match emit_to_destination ( & buffer. render ( ) , level, & mut self . dst ,
1329- self . short_message , & mut self . error_codes ) {
1294+ self . short_message ) {
13301295 Ok ( ( ) ) => ( ) ,
13311296 Err ( e) => panic ! ( "failed to emit error: {}" , e)
13321297 }
@@ -1419,8 +1384,7 @@ fn overlaps(a1: &Annotation, a2: &Annotation, padding: usize) -> bool {
14191384fn emit_to_destination ( rendered_buffer : & Vec < Vec < StyledString > > ,
14201385 lvl : & Level ,
14211386 dst : & mut Destination ,
1422- short_message : bool ,
1423- error_codes : & mut HashSet < String > )
1387+ short_message : bool )
14241388 -> io:: Result < ( ) > {
14251389 use lock;
14261390
@@ -1441,9 +1405,6 @@ fn emit_to_destination(rendered_buffer: &Vec<Vec<StyledString>>,
14411405 for part in line {
14421406 dst. apply_style ( lvl. clone ( ) , part. style ) ?;
14431407 write ! ( dst, "{}" , part. text) ?;
1444- if !short_message && part. text . len ( ) == 12 && part. text . starts_with ( "error[E" ) {
1445- error_codes. insert ( part. text [ 6 ..11 ] . to_owned ( ) ) ;
1446- }
14471408 dst. reset_attrs ( ) ?;
14481409 }
14491410 if !short_message {
0 commit comments