diff options
| author | bors <bors@rust-lang.org> | 2014-01-01 11:06:51 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-01-01 11:06:51 -0800 |
| commit | c34ef5d7e4f44f8e65600a2c3866f5861c401ea1 (patch) | |
| tree | 9c31384ec271d66958fd9cc376232a2f554f74f2 /src/libsyntax | |
| parent | 51ace54597984b221321d1cac0f80c50f9e00f71 (diff) | |
| parent | 9cdad685a39fd826174a6cbcd283ad2dee41e175 (diff) | |
| download | rust-c34ef5d7e4f44f8e65600a2c3866f5861c401ea1.tar.gz rust-c34ef5d7e4f44f8e65600a2c3866f5861c401ea1.zip | |
auto merge of #11255 : klutzy/rust/small-cleanup, r=pcwalton
This patchset removes some `@`s and unnecessary traits, and replaces a function (`dummy_sp()`) returning constant value by static variable.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast_map.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/attr.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/codemap.rs | 13 | ||||
| -rw-r--r-- | src/libsyntax/diagnostic.rs | 128 | ||||
| -rw-r--r-- | src/libsyntax/ext/base.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax/ext/build.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/transcribe.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/parse/comments.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 16 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 6 |
13 files changed, 92 insertions, 124 deletions
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 817cf24eec6..504a51f80a8 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -15,7 +15,7 @@ use ast_util::{inlined_item_utils, stmt_id}; use ast_util; use codemap::Span; use codemap; -use diagnostic::span_handler; +use diagnostic::SpanHandler; use parse::token::get_ident_interner; use parse::token::ident_interner; use parse::token::special_idents; @@ -197,7 +197,7 @@ pub type map = @mut HashMap<NodeId, ast_node>; pub struct Ctx { map: map, path: path, - diag: @mut span_handler, + diag: @mut SpanHandler, } impl Ctx { @@ -418,7 +418,7 @@ impl Visitor<()> for Ctx { } } -pub fn map_crate(diag: @mut span_handler, c: &Crate) -> map { +pub fn map_crate(diag: @mut SpanHandler, c: &Crate) -> map { let cx = @mut Ctx { map: @mut HashMap::new(), path: ~[], @@ -431,7 +431,7 @@ pub fn map_crate(diag: @mut span_handler, c: &Crate) -> map { // Used for items loaded from external crate that are being inlined into this // crate. The `path` should be the path to the item but should not include // the item itself. -pub fn map_decoded_item(diag: @mut span_handler, +pub fn map_decoded_item(diag: @mut SpanHandler, map: map, path: path, ii: &inlined_item) { diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index f2526c29b9a..7a3ac0f2f4d 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -14,7 +14,7 @@ use ast; use ast::{Attribute, Attribute_, MetaItem, MetaWord, MetaNameValue, MetaList}; use codemap::{Span, Spanned, spanned, dummy_spanned}; use codemap::BytePos; -use diagnostic::span_handler; +use diagnostic::SpanHandler; use parse::comments::{doc_comment_style, strip_doc_comment_decoration}; use crateid::CrateId; @@ -355,7 +355,7 @@ pub fn find_stability<AM: AttrMetaMethods, It: Iterator<AM>>(mut metas: It) -> O None } -pub fn require_unique_names(diagnostic: @mut span_handler, +pub fn require_unique_names(diagnostic: @mut SpanHandler, metas: &[@MetaItem]) { let mut set = HashSet::new(); for meta in metas.iter() { @@ -381,7 +381,7 @@ pub fn require_unique_names(diagnostic: @mut span_handler, * present (before fields, if any) with that type; reprensentation * optimizations which would remove it will not be done. */ -pub fn find_repr_attr(diagnostic: @mut span_handler, attr: @ast::MetaItem, acc: ReprAttr) +pub fn find_repr_attr(diagnostic: @mut SpanHandler, attr: @ast::MetaItem, acc: ReprAttr) -> ReprAttr { let mut acc = acc; match attr.node { diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 0509760120a..97d3db074bb 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -90,6 +90,8 @@ pub struct Span { expn_info: Option<@ExpnInfo> } +pub static DUMMY_SP: Span = Span { lo: BytePos(0), hi: BytePos(0), expn_info: None }; + #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub struct Spanned<T> { node: T, @@ -112,7 +114,7 @@ impl<S:Encoder> Encodable<S> for Span { impl<D:Decoder> Decodable<D> for Span { fn decode(_d: &mut D) -> Span { - dummy_sp() + DUMMY_SP } } @@ -125,7 +127,7 @@ pub fn respan<T>(sp: Span, t: T) -> Spanned<T> { } pub fn dummy_spanned<T>(t: T) -> Spanned<T> { - respan(dummy_sp(), t) + respan(DUMMY_SP, t) } /* assuming that we're not in macro expansion */ @@ -133,11 +135,6 @@ pub fn mk_sp(lo: BytePos, hi: BytePos) -> Span { Span {lo: lo, hi: hi, expn_info: None} } -// make this a const, once the compiler supports it -pub fn dummy_sp() -> Span { return mk_sp(BytePos(0), BytePos(0)); } - - - /// A source code location used for error reporting pub struct Loc { /// Information about the original source @@ -350,7 +347,7 @@ impl CodeMap { pub fn span_to_str(&self, sp: Span) -> ~str { let files = &*self.files; - if files.len() == 0 && sp == dummy_sp() { + if files.len() == 0 && sp == DUMMY_SP { return ~"no-location"; } diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 59f33bc7769..c905281cdb2 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -21,28 +21,7 @@ static BUG_REPORT_URL: &'static str = pub trait Emitter { fn emit(&self, - cmsp: Option<(@codemap::CodeMap, Span)>, - msg: &str, - lvl: level); -} - -// a handler deals with errors; certain errors -// (fatal, bug, unimpl) may cause immediate exit, -// others log errors for later reporting. -pub trait handler { - fn fatal(@mut self, msg: &str) -> !; - fn err(@mut self, msg: &str); - fn bump_err_count(@mut self); - fn err_count(@mut self) -> uint; - fn has_errors(@mut self) -> bool; - fn abort_if_errors(@mut self); - fn warn(@mut self, msg: &str); - fn note(@mut self, msg: &str); - // used to indicate a bug in the compiler: - fn bug(@mut self, msg: &str) -> !; - fn unimpl(@mut self, msg: &str) -> !; - fn emit(@mut self, - cmsp: Option<(@codemap::CodeMap, Span)>, + cmsp: Option<(&codemap::CodeMap, Span)>, msg: &str, lvl: level); } @@ -50,71 +29,64 @@ pub trait handler { // a span-handler is like a handler but also // accepts span information for source-location // reporting. -pub trait span_handler { - fn span_fatal(@mut self, sp: Span, msg: &str) -> !; - fn span_err(@mut self, sp: Span, msg: &str); - fn span_warn(@mut self, sp: Span, msg: &str); - fn span_note(@mut self, sp: Span, msg: &str); - fn span_bug(@mut self, sp: Span, msg: &str) -> !; - fn span_unimpl(@mut self, sp: Span, msg: &str) -> !; - fn handler(@mut self) -> @mut handler; -} - -struct HandlerT { - err_count: uint, - emit: @Emitter, -} - -struct CodemapT { - handler: @mut handler, +pub struct SpanHandler { + handler: @mut Handler, cm: @codemap::CodeMap, } -impl span_handler for CodemapT { - fn span_fatal(@mut self, sp: Span, msg: &str) -> ! { - self.handler.emit(Some((self.cm, sp)), msg, fatal); +impl SpanHandler { + pub fn span_fatal(@mut self, sp: Span, msg: &str) -> ! { + self.handler.emit(Some((&*self.cm, sp)), msg, fatal); fail!(); } - fn span_err(@mut self, sp: Span, msg: &str) { - self.handler.emit(Some((self.cm, sp)), msg, error); + pub fn span_err(@mut self, sp: Span, msg: &str) { + self.handler.emit(Some((&*self.cm, sp)), msg, error); self.handler.bump_err_count(); } - fn span_warn(@mut self, sp: Span, msg: &str) { - self.handler.emit(Some((self.cm, sp)), msg, warning); + pub fn span_warn(@mut self, sp: Span, msg: &str) { + self.handler.emit(Some((&*self.cm, sp)), msg, warning); } - fn span_note(@mut self, sp: Span, msg: &str) { - self.handler.emit(Some((self.cm, sp)), msg, note); + pub fn span_note(@mut self, sp: Span, msg: &str) { + self.handler.emit(Some((&*self.cm, sp)), msg, note); } - fn span_bug(@mut self, sp: Span, msg: &str) -> ! { + pub fn span_bug(@mut self, sp: Span, msg: &str) -> ! { self.span_fatal(sp, ice_msg(msg)); } - fn span_unimpl(@mut self, sp: Span, msg: &str) -> ! { + pub fn span_unimpl(@mut self, sp: Span, msg: &str) -> ! { self.span_bug(sp, ~"unimplemented " + msg); } - fn handler(@mut self) -> @mut handler { + pub fn handler(@mut self) -> @mut Handler { self.handler } } -impl handler for HandlerT { - fn fatal(@mut self, msg: &str) -> ! { +// a handler deals with errors; certain errors +// (fatal, bug, unimpl) may cause immediate exit, +// others log errors for later reporting. +pub struct Handler { + err_count: uint, + emit: @Emitter, +} + +impl Handler { + pub fn fatal(@mut self, msg: &str) -> ! { self.emit.emit(None, msg, fatal); fail!(); } - fn err(@mut self, msg: &str) { + pub fn err(@mut self, msg: &str) { self.emit.emit(None, msg, error); self.bump_err_count(); } - fn bump_err_count(@mut self) { + pub fn bump_err_count(@mut self) { self.err_count += 1u; } - fn err_count(@mut self) -> uint { + pub fn err_count(@mut self) -> uint { self.err_count } - fn has_errors(@mut self) -> bool { + pub fn has_errors(@mut self) -> bool { self.err_count > 0u } - fn abort_if_errors(@mut self) { + pub fn abort_if_errors(@mut self) { let s; match self.err_count { 0u => return, @@ -126,20 +98,20 @@ impl handler for HandlerT { } self.fatal(s); } - fn warn(@mut self, msg: &str) { + pub fn warn(@mut self, msg: &str) { self.emit.emit(None, msg, warning); } - fn note(@mut self, msg: &str) { + pub fn note(@mut self, msg: &str) { self.emit.emit(None, msg, note); } - fn bug(@mut self, msg: &str) -> ! { + pub fn bug(@mut self, msg: &str) -> ! { self.fatal(ice_msg(msg)); } - fn unimpl(@mut self, msg: &str) -> ! { + pub fn unimpl(@mut self, msg: &str) -> ! { self.bug(~"unimplemented " + msg); } - fn emit(@mut self, - cmsp: Option<(@codemap::CodeMap, Span)>, + pub fn emit(@mut self, + cmsp: Option<(&codemap::CodeMap, Span)>, msg: &str, lvl: level) { self.emit.emit(cmsp, msg, lvl); @@ -151,24 +123,24 @@ pub fn ice_msg(msg: &str) -> ~str { \nWe would appreciate a bug report: {}", msg, BUG_REPORT_URL) } -pub fn mk_span_handler(handler: @mut handler, cm: @codemap::CodeMap) - -> @mut span_handler { - @mut CodemapT { +pub fn mk_span_handler(handler: @mut Handler, cm: @codemap::CodeMap) + -> @mut SpanHandler { + @mut SpanHandler { handler: handler, cm: cm, - } as @mut span_handler + } } -pub fn mk_handler(emitter: Option<@Emitter>) -> @mut handler { +pub fn mk_handler(emitter: Option<@Emitter>) -> @mut Handler { let emit: @Emitter = match emitter { Some(e) => e, None => @DefaultEmitter as @Emitter }; - @mut HandlerT { + @mut Handler { err_count: 0, emit: emit, - } as @mut handler + } } #[deriving(Eq)] @@ -255,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 { @@ -272,10 +244,10 @@ 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; @@ -283,9 +255,9 @@ fn highlight_lines(cm: @codemap::CodeMap, // 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 @@ -339,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 { @@ -356,7 +328,7 @@ fn print_macro_backtrace(cm: @codemap::CodeMap, sp: Span) { } pub fn expect<T:Clone>( - diag: @mut span_handler, + diag: @mut SpanHandler, opt: Option<T>, msg: || -> ~str) -> T { diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index ccbc533fbcc..7c2dad34002 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -12,7 +12,6 @@ use ast; use ast::Name; use codemap; use codemap::{CodeMap, Span, ExpnInfo}; -use diagnostic::span_handler; use ext; use ext::expand; use parse; diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index e5f20950412..1a3513ab81c 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -12,7 +12,7 @@ use abi::AbiSet; use ast::{P, Ident}; use ast; use ast_util; -use codemap::{Span, respan, dummy_sp}; +use codemap::{Span, respan, DUMMY_SP}; use ext::base::ExtCtxt; use ext::quote::rt::*; use fold::ast_fold; @@ -321,7 +321,7 @@ impl AstBuilder for ExtCtxt { fn ty_option(&self, ty: P<ast::Ty>) -> P<ast::Ty> { self.ty_path( - self.path_all(dummy_sp(), + self.path_all(DUMMY_SP, true, ~[ self.ident_of("std"), @@ -348,7 +348,7 @@ impl AstBuilder for ExtCtxt { P(ast::Ty { id: ast::DUMMY_NODE_ID, node: ast::ty_nil, - span: dummy_sp(), + span: DUMMY_SP, }) } @@ -361,13 +361,13 @@ impl AstBuilder for ExtCtxt { // incorrect code. fn ty_vars(&self, ty_params: &OptVec<ast::TyParam>) -> ~[P<ast::Ty>] { opt_vec::take_vec( - ty_params.map(|p| self.ty_ident(dummy_sp(), p.ident))) + ty_params.map(|p| self.ty_ident(DUMMY_SP, p.ident))) } fn ty_vars_global(&self, ty_params: &OptVec<ast::TyParam>) -> ~[P<ast::Ty>] { opt_vec::take_vec( ty_params.map(|p| self.ty_path( - self.path_global(dummy_sp(), ~[p.ident]), None))) + self.path_global(DUMMY_SP, ~[p.ident]), None))) } fn strip_bounds(&self, generics: &Generics) -> Generics { diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index eb07353cda3..be336128275 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1279,12 +1279,12 @@ mod test { // make a MetaWord outer attribute with the given name fn make_dummy_attr(s: @str) -> ast::Attribute { Spanned { - span:codemap::dummy_sp(), + span:codemap::DUMMY_SP, node: Attribute_ { style: AttrOuter, value: @Spanned { node: MetaWord(s), - span: codemap::dummy_sp(), + span: codemap::DUMMY_SP, }, is_sugared_doc: false, } diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index ae9bbdadf2c..05d402a2ba2 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -11,7 +11,7 @@ use ast::{Ident, matcher_, matcher, match_tok, match_nonterminal, match_seq}; use ast::{tt_delim}; use ast; -use codemap::{Span, Spanned, dummy_sp}; +use codemap::{Span, Spanned, DUMMY_SP}; use ext::base::{AnyMacro, ExtCtxt, MacResult, MRAny, MRDef, MacroDef}; use ext::base::{NormalTT, SyntaxExpanderTTTrait}; use ext::base; @@ -109,7 +109,7 @@ fn generic_extension(cx: &ExtCtxt, } // Which arm's failure should we report? (the one furthest along) - let mut best_fail_spot = dummy_sp(); + let mut best_fail_spot = DUMMY_SP; let mut best_fail_msg = ~"internal error: ran no matchers"; let s_d = cx.parse_sess().span_diagnostic; @@ -178,7 +178,7 @@ pub fn add_new_extension(cx: &mut ExtCtxt, fn ms(m: matcher_) -> matcher { Spanned { node: m.clone(), - span: dummy_sp() + span: DUMMY_SP } } diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index 58a114a2de0..cbce5fb16cb 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -10,8 +10,8 @@ use ast; use ast::{token_tree, tt_delim, tt_tok, tt_seq, tt_nonterminal,Ident}; -use codemap::{Span, dummy_sp}; -use diagnostic::span_handler; +use codemap::{Span, DUMMY_SP}; +use diagnostic::SpanHandler; use ext::tt::macro_parser::{named_match, matched_seq, matched_nonterminal}; use parse::token::{EOF, INTERPOLATED, IDENT, Token, nt_ident}; use parse::token::{ident_to_str}; @@ -30,7 +30,7 @@ struct TtFrame { } pub struct TtReader { - sp_diag: @mut span_handler, + sp_diag: @mut SpanHandler, // the unzipped tree: stack: @mut TtFrame, /* for MBE-style macro transcription */ @@ -45,7 +45,7 @@ pub struct TtReader { /** This can do Macro-By-Example transcription. On the other hand, if * `src` contains no `tt_seq`s and `tt_nonterminal`s, `interp` can (and * should) be none. */ -pub fn new_tt_reader(sp_diag: @mut span_handler, +pub fn new_tt_reader(sp_diag: @mut SpanHandler, interp: Option<HashMap<Ident,@named_match>>, src: ~[ast::token_tree]) -> @mut TtReader { @@ -66,7 +66,7 @@ pub fn new_tt_reader(sp_diag: @mut span_handler, repeat_len: ~[], /* dummy values, never read: */ cur_tok: EOF, - cur_span: dummy_sp() + cur_span: DUMMY_SP }; tt_next_token(r); /* get cur_tok and cur_span set up */ return r; diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index 0704bf913d7..b1390253d19 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -342,7 +342,7 @@ pub struct lit { // it appears this function is called only from pprust... that's // probably not a good thing. pub fn gather_comments_and_literals(span_diagnostic: - @mut diagnostic::span_handler, + @mut diagnostic::SpanHandler, path: @str, srdr: &mut io::Reader) -> (~[cmnt], ~[lit]) { diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index d48c1d9d8d7..2c3d03eefea 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -11,7 +11,7 @@ use ast; use codemap::{BytePos, CharPos, CodeMap, Pos, Span}; use codemap; -use diagnostic::span_handler; +use diagnostic::SpanHandler; use ext::tt::transcribe::{tt_next_token}; use ext::tt::transcribe::{dup_tt_reader}; use parse::token; @@ -29,7 +29,7 @@ pub trait reader { fn is_eof(@mut self) -> bool; fn next_token(@mut self) -> TokenAndSpan; fn fatal(@mut self, ~str) -> !; - fn span_diag(@mut self) -> @mut span_handler; + fn span_diag(@mut self) -> @mut SpanHandler; fn peek(@mut self) -> TokenAndSpan; fn dup(@mut self) -> @mut reader; } @@ -41,7 +41,7 @@ pub struct TokenAndSpan { } pub struct StringReader { - span_diagnostic: @mut span_handler, + span_diagnostic: @mut SpanHandler, src: @str, // The absolute offset within the codemap of the next character to read pos: BytePos, @@ -57,7 +57,7 @@ pub struct StringReader { peek_span: Span } -pub fn new_string_reader(span_diagnostic: @mut span_handler, +pub fn new_string_reader(span_diagnostic: @mut SpanHandler, filemap: @codemap::FileMap) -> @mut StringReader { let r = new_low_level_string_reader(span_diagnostic, filemap); @@ -66,7 +66,7 @@ pub fn new_string_reader(span_diagnostic: @mut span_handler, } /* For comments.rs, which hackily pokes into 'pos' and 'curr' */ -pub fn new_low_level_string_reader(span_diagnostic: @mut span_handler, +pub fn new_low_level_string_reader(span_diagnostic: @mut SpanHandler, filemap: @codemap::FileMap) -> @mut StringReader { // Force the initial reader bump to start on a fresh line @@ -81,7 +81,7 @@ pub fn new_low_level_string_reader(span_diagnostic: @mut span_handler, filemap: filemap, /* dummy values; not read */ peek_tok: token::EOF, - peek_span: codemap::dummy_sp() + peek_span: codemap::DUMMY_SP }; bump(r); return r; @@ -118,7 +118,7 @@ impl reader for StringReader { fn fatal(@mut self, m: ~str) -> ! { self.span_diagnostic.span_fatal(self.peek_span, m) } - fn span_diag(@mut self) -> @mut span_handler { self.span_diagnostic } + fn span_diag(@mut self) -> @mut SpanHandler { self.span_diagnostic } fn peek(@mut self) -> TokenAndSpan { // XXX(pcwalton): Bad copy! TokenAndSpan { @@ -139,7 +139,7 @@ impl reader for TtReader { fn fatal(@mut self, m: ~str) -> ! { self.sp_diag.span_fatal(self.cur_span, m); } - fn span_diag(@mut self) -> @mut span_handler { self.sp_diag } + fn span_diag(@mut self) -> @mut SpanHandler { self.sp_diag } fn peek(@mut self) -> TokenAndSpan { TokenAndSpan { tok: self.cur_tok.clone(), diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 73240a9effd..8aedc146240 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -14,7 +14,7 @@ use ast; use codemap::{Span, CodeMap, FileMap, FileSubstr}; use codemap; -use diagnostic::{span_handler, mk_span_handler, mk_handler, Emitter}; +use diagnostic::{SpanHandler, mk_span_handler, mk_handler, Emitter}; use parse::attr::parser_attr; use parse::lexer::reader; use parse::parser::Parser; @@ -41,7 +41,7 @@ pub mod obsolete; // info about a parsing session. pub struct ParseSess { cm: @codemap::CodeMap, // better be the same as the one in the reader! - span_diagnostic: @mut span_handler, // better be the same as the one in the reader! + span_diagnostic: @mut SpanHandler, // better be the same as the one in the reader! /// Used to determine and report recursive mod inclusions included_mod_stack: ~[Path], } @@ -55,7 +55,7 @@ pub fn new_parse_sess(demitter: Option<@Emitter>) -> @mut ParseSess { } } -pub fn new_parse_sess_special_handler(sh: @mut span_handler, +pub fn new_parse_sess_special_handler(sh: @mut SpanHandler, cm: @codemap::CodeMap) -> @mut ParseSess { @mut ParseSess { diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 7cea2ed3f9c..960e28ca84f 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -118,7 +118,7 @@ pub static default_columns: uint = 78u; // copy forward. pub fn print_crate(cm: @CodeMap, intr: @ident_interner, - span_diagnostic: @mut diagnostic::span_handler, + span_diagnostic: @mut diagnostic::SpanHandler, crate: &ast::Crate, filename: @str, input: @mut io::Reader, @@ -2422,7 +2422,7 @@ mod test { inputs: ~[], output: ast::P(ast::Ty {id: 0, node: ast::ty_nil, - span: codemap::dummy_sp()}), + span: codemap::DUMMY_SP}), cf: ast::return_val, variadic: false }; @@ -2436,7 +2436,7 @@ mod test { fn test_variant_to_str() { let ident = token::str_to_ident("principal_skinner"); - let var = codemap::respan(codemap::dummy_sp(), ast::variant_ { + let var = codemap::respan(codemap::DUMMY_SP, ast::variant_ { name: ident, attrs: ~[], // making this up as I go.... ? |
