Skip to content

Commit 4a7b710

Browse files
committed
Fix checking of command line expansion spans (fixes #20747)
1 parent 8c6bd81 commit 4a7b710

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/libsyntax/diagnostic.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub use self::RenderSpan::*;
1313
pub use self::ColorConfig::*;
1414
use self::Destination::*;
1515

16-
use codemap::{COMMAND_LINE_SP, Pos, Span};
16+
use codemap::{COMMAND_LINE_SP, COMMAND_LINE_EXPN, Pos, Span};
1717
use codemap;
1818
use diagnostics;
1919

@@ -393,7 +393,10 @@ impl Emitter for EmitterWriter {
393393
fn emit(dst: &mut EmitterWriter, cm: &codemap::CodeMap, rsp: RenderSpan,
394394
msg: &str, code: Option<&str>, lvl: Level, custom: bool) -> io::IoResult<()> {
395395
let sp = rsp.span();
396-
let ss = if sp == COMMAND_LINE_SP {
396+
397+
// We cannot check equality directly with COMMAND_LINE_SP
398+
// since PartialEq is manually implemented to ignore the ExpnId
399+
let ss = if sp.expn_id == COMMAND_LINE_EXPN {
397400
"<command line option>".to_string()
398401
} else {
399402
cm.span_to_string(sp)

0 commit comments

Comments
 (0)