Skip to content

Commit 4ded731

Browse files
committed
Span's PartialEq ignores expn_id, so compare sp.expn_id not sp
We already fixed the comparison at the top of this function.
1 parent 382c004 commit 4ded731

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/libsyntax/diagnostic.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,8 @@ fn emit(dst: &mut EmitterWriter, cm: &codemap::CodeMap, rsp: RenderSpan,
433433

434434
// We cannot check equality directly with COMMAND_LINE_SP
435435
// since PartialEq is manually implemented to ignore the ExpnId
436-
let ss = if sp.expn_id == COMMAND_LINE_EXPN {
436+
let is_command_line = sp.expn_id == COMMAND_LINE_EXPN;
437+
let ss = if is_command_line {
437438
"<command line option>".to_string()
438439
} else {
439440
cm.span_to_string(sp)
@@ -454,7 +455,7 @@ fn emit(dst: &mut EmitterWriter, cm: &codemap::CodeMap, rsp: RenderSpan,
454455
try!(highlight_lines(dst, cm, sp, lvl, cm.span_to_lines(sp)));
455456
}
456457
}
457-
if sp != COMMAND_LINE_SP && rsp.is_full_span() {
458+
if !is_command_line && rsp.is_full_span() {
458459
try!(print_macro_backtrace(dst, cm, sp));
459460
}
460461
match code {

0 commit comments

Comments
 (0)