@@ -166,6 +166,9 @@ impl EmitterWriter {
166
166
167
167
if let Some ( ref cm) = self . cm {
168
168
for span_label in msp. span_labels ( ) {
169
+ if span_label. span == DUMMY_SP || span_label. span == COMMAND_LINE_SP {
170
+ continue ;
171
+ }
169
172
let lo = cm. lookup_char_pos ( span_label. span . lo ) ;
170
173
let mut hi = cm. lookup_char_pos ( span_label. span . hi ) ;
171
174
let mut is_minimized = false ;
@@ -386,15 +389,19 @@ impl EmitterWriter {
386
389
let mut max = 0 ;
387
390
if let Some ( ref cm) = self . cm {
388
391
for primary_span in msp. primary_spans ( ) {
389
- let hi = cm. lookup_char_pos ( primary_span. hi ) ;
390
- if hi. line > max {
391
- max = hi. line ;
392
+ if primary_span != & DUMMY_SP && primary_span != & COMMAND_LINE_SP {
393
+ let hi = cm. lookup_char_pos ( primary_span. hi ) ;
394
+ if hi. line > max {
395
+ max = hi. line ;
396
+ }
392
397
}
393
398
}
394
399
for span_label in msp. span_labels ( ) {
395
- let hi = cm. lookup_char_pos ( span_label. span . hi ) ;
396
- if hi. line > max {
397
- max = hi. line ;
400
+ if span_label. span != DUMMY_SP && span_label. span != COMMAND_LINE_SP {
401
+ let hi = cm. lookup_char_pos ( span_label. span . hi ) ;
402
+ if hi. line > max {
403
+ max = hi. line ;
404
+ }
398
405
}
399
406
}
400
407
}
@@ -456,7 +463,13 @@ impl EmitterWriter {
456
463
let primary_lo =
457
464
if let ( Some ( ref cm) , Some ( ref primary_span) ) = ( self . cm . as_ref ( ) ,
458
465
msp. primary_span ( ) . as_ref ( ) ) {
459
- cm. lookup_char_pos ( primary_span. lo )
466
+ if primary_span != & & DUMMY_SP && primary_span != & & COMMAND_LINE_SP {
467
+ cm. lookup_char_pos ( primary_span. lo )
468
+ }
469
+ else {
470
+ emit_to_destination ( & buffer. render ( ) , level, & mut self . dst ) ?;
471
+ return Ok ( ( ) ) ;
472
+ }
460
473
} else {
461
474
// If we don't have span information, emit and exit
462
475
emit_to_destination ( & buffer. render ( ) , level, & mut self . dst ) ?;
0 commit comments