Skip to content

Commit

Permalink
Fix checking of command line expansion spans (fixes #20747)
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Jan 9, 2015
1 parent 8c6bd81 commit 4a7b710
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/libsyntax/diagnostic.rs
Expand Up @@ -13,7 +13,7 @@ pub use self::RenderSpan::*;
pub use self::ColorConfig::*;
use self::Destination::*;

use codemap::{COMMAND_LINE_SP, Pos, Span};
use codemap::{COMMAND_LINE_SP, COMMAND_LINE_EXPN, Pos, Span};
use codemap;
use diagnostics;

Expand Down Expand Up @@ -393,7 +393,10 @@ impl Emitter for EmitterWriter {
fn emit(dst: &mut EmitterWriter, cm: &codemap::CodeMap, rsp: RenderSpan,
msg: &str, code: Option<&str>, lvl: Level, custom: bool) -> io::IoResult<()> {
let sp = rsp.span();
let ss = if sp == COMMAND_LINE_SP {

// We cannot check equality directly with COMMAND_LINE_SP
// since PartialEq is manually implemented to ignore the ExpnId
let ss = if sp.expn_id == COMMAND_LINE_EXPN {
"<command line option>".to_string()
} else {
cm.span_to_string(sp)
Expand Down

0 comments on commit 4a7b710

Please sign in to comment.