Skip to content

Commit

Permalink
syntax::diagnostic: Remove @ from Emitter
Browse files Browse the repository at this point in the history
  • Loading branch information
klutzy committed Jan 1, 2014
1 parent fe10c63 commit db204b2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/librustc/lib.rs
Expand Up @@ -348,7 +348,7 @@ struct RustcEmitter {

impl diagnostic::Emitter for RustcEmitter {
fn emit(&self,
cmsp: Option<(@codemap::CodeMap, codemap::Span)>,
cmsp: Option<(&codemap::CodeMap, codemap::Span)>,
msg: &str,
lvl: diagnostic::level) {
if lvl == diagnostic::fatal {
Expand Down
24 changes: 12 additions & 12 deletions src/libsyntax/diagnostic.rs
Expand Up @@ -21,7 +21,7 @@ static BUG_REPORT_URL: &'static str =

pub trait Emitter {
fn emit(&self,
cmsp: Option<(@codemap::CodeMap, Span)>,
cmsp: Option<(&codemap::CodeMap, Span)>,
msg: &str,
lvl: level);
}
Expand All @@ -36,18 +36,18 @@ pub struct SpanHandler {

impl SpanHandler {
pub fn span_fatal(@mut self, sp: Span, msg: &str) -> ! {
self.handler.emit(Some((self.cm, sp)), msg, fatal);
self.handler.emit(Some((&*self.cm, sp)), msg, fatal);
fail!();
}
pub fn span_err(@mut self, sp: Span, msg: &str) {
self.handler.emit(Some((self.cm, sp)), msg, error);
self.handler.emit(Some((&*self.cm, sp)), msg, error);
self.handler.bump_err_count();
}
pub fn span_warn(@mut self, sp: Span, msg: &str) {
self.handler.emit(Some((self.cm, sp)), msg, warning);
self.handler.emit(Some((&*self.cm, sp)), msg, warning);
}
pub fn span_note(@mut self, sp: Span, msg: &str) {
self.handler.emit(Some((self.cm, sp)), msg, note);
self.handler.emit(Some((&*self.cm, sp)), msg, note);
}
pub fn span_bug(@mut self, sp: Span, msg: &str) -> ! {
self.span_fatal(sp, ice_msg(msg));
Expand Down Expand Up @@ -111,7 +111,7 @@ impl Handler {
self.bug(~"unimplemented " + msg);
}
pub fn emit(@mut self,
cmsp: Option<(@codemap::CodeMap, Span)>,
cmsp: Option<(&codemap::CodeMap, Span)>,
msg: &str,
lvl: level) {
self.emit.emit(cmsp, msg, lvl);
Expand Down Expand Up @@ -227,7 +227,7 @@ pub struct DefaultEmitter;

impl Emitter for DefaultEmitter {
fn emit(&self,
cmsp: Option<(@codemap::CodeMap, Span)>,
cmsp: Option<(&codemap::CodeMap, Span)>,
msg: &str,
lvl: level) {
match cmsp {
Expand All @@ -244,20 +244,20 @@ impl Emitter for DefaultEmitter {
}
}

fn highlight_lines(cm: @codemap::CodeMap,
fn highlight_lines(cm: &codemap::CodeMap,
sp: Span,
lvl: level,
lines: @codemap::FileLines) {
lines: &codemap::FileLines) {
let fm = lines.file;
let mut err = io::stderr();
let err = &mut err as &mut io::Writer;

// arbitrarily only print up to six lines of the error
let max_lines = 6u;
let mut elided = false;
let mut display_lines = /* FIXME (#2543) */ lines.lines.clone();
let mut display_lines = lines.lines.as_slice();
if display_lines.len() > max_lines {
display_lines = display_lines.slice(0u, max_lines).to_owned();
display_lines = display_lines.slice(0u, max_lines);
elided = true;
}
// Print the offending lines
Expand Down Expand Up @@ -311,7 +311,7 @@ fn highlight_lines(cm: @codemap::CodeMap,
}
}

fn print_macro_backtrace(cm: @codemap::CodeMap, sp: Span) {
fn print_macro_backtrace(cm: &codemap::CodeMap, sp: Span) {
for ei in sp.expn_info.iter() {
let ss = ei.callee.span.as_ref().map_default(~"", |span| cm.span_to_str(*span));
let (pre, post) = match ei.callee.format {
Expand Down

0 comments on commit db204b2

Please sign in to comment.