@@ -21,7 +21,7 @@ use std::io::prelude::*;
21
21
use std:: io;
22
22
use std:: rc:: Rc ;
23
23
use term;
24
- use std:: collections:: { HashMap , HashSet } ;
24
+ use std:: collections:: HashMap ;
25
25
use std:: cmp:: min;
26
26
use unicode_width;
27
27
@@ -109,7 +109,6 @@ pub struct EmitterWriter {
109
109
cm : Option < Rc < CodeMapper > > ,
110
110
short_message : bool ,
111
111
teach : bool ,
112
- error_codes : HashSet < String > ,
113
112
ui_testing : bool ,
114
113
}
115
114
@@ -119,33 +118,6 @@ struct FileWithAnnotatedLines {
119
118
multiline_depth : usize ,
120
119
}
121
120
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
-
149
121
impl EmitterWriter {
150
122
pub fn stderr ( color_config : ColorConfig ,
151
123
code_map : Option < Rc < CodeMapper > > ,
@@ -159,7 +131,6 @@ impl EmitterWriter {
159
131
cm : code_map,
160
132
short_message,
161
133
teach,
162
- error_codes : HashSet :: new ( ) ,
163
134
ui_testing : false ,
164
135
}
165
136
} else {
@@ -168,7 +139,6 @@ impl EmitterWriter {
168
139
cm : code_map,
169
140
short_message,
170
141
teach,
171
- error_codes : HashSet :: new ( ) ,
172
142
ui_testing : false ,
173
143
}
174
144
}
@@ -184,7 +154,6 @@ impl EmitterWriter {
184
154
cm : code_map,
185
155
short_message,
186
156
teach,
187
- error_codes : HashSet :: new ( ) ,
188
157
ui_testing : false ,
189
158
}
190
159
}
@@ -1025,14 +994,12 @@ impl EmitterWriter {
1025
994
if primary_span != & & DUMMY_SP {
1026
995
( cm. lookup_char_pos ( primary_span. lo ( ) ) , cm)
1027
996
} 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 ) ?;
1030
998
return Ok ( ( ) ) ;
1031
999
}
1032
1000
} else {
1033
1001
// 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 ) ?;
1036
1003
return Ok ( ( ) ) ;
1037
1004
} ;
1038
1005
if let Ok ( pos) =
@@ -1205,8 +1172,7 @@ impl EmitterWriter {
1205
1172
}
1206
1173
1207
1174
// 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 ) ?;
1210
1176
1211
1177
Ok ( ( ) )
1212
1178
@@ -1294,8 +1260,7 @@ impl EmitterWriter {
1294
1260
let msg = format ! ( "and {} other candidates" , suggestions. len( ) - MAX_SUGGESTIONS ) ;
1295
1261
buffer. puts ( row_num, 0 , & msg, Style :: NoStyle ) ;
1296
1262
}
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 ) ?;
1299
1264
}
1300
1265
Ok ( ( ) )
1301
1266
}
@@ -1326,7 +1291,7 @@ impl EmitterWriter {
1326
1291
draw_col_separator_no_space ( & mut buffer, 0 , max_line_num_len + 1 ) ;
1327
1292
}
1328
1293
match emit_to_destination ( & buffer. render ( ) , level, & mut self . dst ,
1329
- self . short_message , & mut self . error_codes ) {
1294
+ self . short_message ) {
1330
1295
Ok ( ( ) ) => ( ) ,
1331
1296
Err ( e) => panic ! ( "failed to emit error: {}" , e)
1332
1297
}
@@ -1419,8 +1384,7 @@ fn overlaps(a1: &Annotation, a2: &Annotation, padding: usize) -> bool {
1419
1384
fn emit_to_destination ( rendered_buffer : & Vec < Vec < StyledString > > ,
1420
1385
lvl : & Level ,
1421
1386
dst : & mut Destination ,
1422
- short_message : bool ,
1423
- error_codes : & mut HashSet < String > )
1387
+ short_message : bool )
1424
1388
-> io:: Result < ( ) > {
1425
1389
use lock;
1426
1390
@@ -1441,9 +1405,6 @@ fn emit_to_destination(rendered_buffer: &Vec<Vec<StyledString>>,
1441
1405
for part in line {
1442
1406
dst. apply_style ( lvl. clone ( ) , part. style ) ?;
1443
1407
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
- }
1447
1408
dst. reset_attrs ( ) ?;
1448
1409
}
1449
1410
if !short_message {
0 commit comments