From daf5f5a4d10513ff42e79fa7ef8819b170f3a13d Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 21 Oct 2013 13:08:31 -0700 Subject: Drop the '2' suffix from logging macros Who doesn't like a massive renaming? --- src/libsyntax/abi.rs | 10 +++---- src/libsyntax/ast.rs | 2 +- src/libsyntax/ast_map.rs | 4 +-- src/libsyntax/ast_util.rs | 20 +++++++------- src/libsyntax/attr.rs | 22 +++++++-------- src/libsyntax/codemap.rs | 14 +++++----- src/libsyntax/diagnostic.rs | 4 +-- src/libsyntax/ext/base.rs | 6 ++--- src/libsyntax/ext/expand.rs | 42 ++++++++++++++--------------- src/libsyntax/ext/quote.rs | 10 +++---- src/libsyntax/ext/tt/macro_parser.rs | 6 ++--- src/libsyntax/fold.rs | 2 +- src/libsyntax/opt_vec.rs | 2 +- src/libsyntax/parse/attr.rs | 4 +-- src/libsyntax/parse/comments.rs | 32 +++++++++++----------- src/libsyntax/parse/lexer.rs | 6 ++--- src/libsyntax/parse/mod.rs | 6 ++--- src/libsyntax/parse/parser.rs | 26 +++++++++--------- src/libsyntax/parse/token.rs | 6 ++--- src/libsyntax/print/pp.rs | 52 ++++++++++++++++++------------------ src/libsyntax/print/pprust.rs | 14 +++++----- 21 files changed, 145 insertions(+), 145 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs index 4875ef6d3ca..ed20b160eb4 100644 --- a/src/libsyntax/abi.rs +++ b/src/libsyntax/abi.rs @@ -221,7 +221,7 @@ impl AbiSet { let data = abi.data(); for other_abi in abis.slice(0, i).iter() { let other_data = other_abi.data(); - debug2!("abis=({:?},{:?}) datas=({:?},{:?})", + debug!("abis=({:?},{:?}) datas=({:?},{:?})", abi, data.abi_arch, other_abi, other_data.abi_arch); match (&data.abi_arch, &other_data.abi_arch) { @@ -306,7 +306,7 @@ fn cannot_combine(n: Abi, m: Abi) { (m == a && n == b)); } None => { - fail2!("Invalid match not detected"); + fail!("Invalid match not detected"); } } } @@ -318,7 +318,7 @@ fn can_combine(n: Abi, m: Abi) { set.add(m); match set.check_valid() { Some((_, _)) => { - fail2!("Valid match declared invalid"); + fail!("Valid match declared invalid"); } None => {} } @@ -367,7 +367,7 @@ fn abi_to_str_c_aaps() { let mut set = AbiSet::empty(); set.add(Aapcs); set.add(C); - debug2!("set = {}", set.to_str()); + debug!("set = {}", set.to_str()); assert!(set.to_str() == ~"\"aapcs C\""); } @@ -375,7 +375,7 @@ fn abi_to_str_c_aaps() { fn abi_to_str_rust() { let mut set = AbiSet::empty(); set.add(Rust); - debug2!("set = {}", set.to_str()); + debug!("set = {}", set.to_str()); assert!(set.to_str() == ~"\"Rust\""); } diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 34b359ef3db..01033e829f6 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -47,7 +47,7 @@ impl Eq for Ident { // if it should be non-hygienic (most things are), just compare the // 'name' fields of the idents. Or, even better, replace the idents // with Name's. - fail2!("not allowed to compare these idents: {:?}, {:?}. + fail!("not allowed to compare these idents: {:?}, {:?}. Probably related to issue \\#6993", self, other); } } diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 83205ccc981..17613d19c7e 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -185,7 +185,7 @@ impl Ctx { item, p)); } - _ => fail2!("struct def parent wasn't an item") + _ => fail!("struct def parent wasn't an item") } } } @@ -485,6 +485,6 @@ pub fn node_item_query(items: map, id: NodeId, error_msg: ~str) -> Result { match items.find(&id) { Some(&node_item(it, _)) => query(it), - _ => fail2!("{}", error_msg) + _ => fail!("{}", error_msg) } } diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 7295081afba..bdebc9872e6 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -45,7 +45,7 @@ pub fn stmt_id(s: &Stmt) -> NodeId { StmtDecl(_, id) => id, StmtExpr(_, id) => id, StmtSemi(_, id) => id, - StmtMac(*) => fail2!("attempted to analyze unexpanded stmt") + StmtMac(*) => fail!("attempted to analyze unexpanded stmt") } } @@ -72,7 +72,7 @@ pub fn def_id_of_def(d: Def) -> DefId { local_def(id) } - DefPrimTy(_) => fail2!() + DefPrimTy(_) => fail!() } } @@ -735,7 +735,7 @@ pub fn new_mark_internal(m:Mrk, tail:SyntaxContext,table:&mut SCTable) } true => { match table.mark_memo.find(&key) { - None => fail2!("internal error: key disappeared 2013042901"), + None => fail!("internal error: key disappeared 2013042901"), Some(idxptr) => {*idxptr} } } @@ -762,7 +762,7 @@ pub fn new_rename_internal(id:Ident, to:Name, tail:SyntaxContext, table: &mut SC } true => { match table.rename_memo.find(&key) { - None => fail2!("internal error: key disappeared 2013042902"), + None => fail!("internal error: key disappeared 2013042902"), Some(idxptr) => {*idxptr} } } @@ -795,9 +795,9 @@ pub fn get_sctable() -> @mut SCTable { /// print out an SCTable for debugging pub fn display_sctable(table : &SCTable) { - error2!("SC table:"); + error!("SC table:"); for (idx,val) in table.table.iter().enumerate() { - error2!("{:4u} : {:?}",idx,val); + error!("{:4u} : {:?}",idx,val); } } @@ -859,7 +859,7 @@ pub fn resolve_internal(id : Ident, resolvedthis } } - IllegalCtxt() => fail2!("expected resolvable context, got IllegalCtxt") + IllegalCtxt() => fail!("expected resolvable context, got IllegalCtxt") } }; resolve_table.insert(key,resolved); @@ -900,7 +900,7 @@ pub fn marksof(ctxt: SyntaxContext, stopname: Name, table: &SCTable) -> ~[Mrk] { loopvar = tl; } } - IllegalCtxt => fail2!("expected resolvable context, got IllegalCtxt") + IllegalCtxt => fail!("expected resolvable context, got IllegalCtxt") } } } @@ -911,7 +911,7 @@ pub fn mtwt_outer_mark(ctxt: SyntaxContext) -> Mrk { let sctable = get_sctable(); match sctable.table[ctxt] { ast::Mark(mrk,_) => mrk, - _ => fail2!("can't retrieve outer mark when outside is not a mark") + _ => fail!("can't retrieve outer mark when outside is not a mark") } } @@ -1043,7 +1043,7 @@ mod test { sc = tail; continue; } - IllegalCtxt => fail2!("expected resolvable context, got IllegalCtxt") + IllegalCtxt => fail!("expected resolvable context, got IllegalCtxt") } } } diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 47b31a4f76d..40b7ff29e24 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -168,17 +168,17 @@ pub fn mk_sugared_doc_attr(text: @str, lo: BytePos, hi: BytePos) -> Attribute { /// span included in the `==` comparison a plain MetaItem. pub fn contains(haystack: &[@ast::MetaItem], needle: @ast::MetaItem) -> bool { - debug2!("attr::contains (name={})", needle.name()); + debug!("attr::contains (name={})", needle.name()); do haystack.iter().any |item| { - debug2!(" testing: {}", item.name()); + debug!(" testing: {}", item.name()); item.node == needle.node } } pub fn contains_name(metas: &[AM], name: &str) -> bool { - debug2!("attr::contains_name (name={})", name); + debug!("attr::contains_name (name={})", name); do metas.iter().any |item| { - debug2!(" testing: {}", item.name()); + debug!(" testing: {}", item.name()); name == item.name() } } @@ -279,23 +279,23 @@ pub fn test_cfg> // this would be much nicer as a chain of iterator adaptors, but // this doesn't work. let some_cfg_matches = do metas.any |mi| { - debug2!("testing name: {}", mi.name()); + debug!("testing name: {}", mi.name()); if "cfg" == mi.name() { // it is a #[cfg()] attribute - debug2!("is cfg"); + debug!("is cfg"); no_cfgs = false; // only #[cfg(...)] ones are understood. match mi.meta_item_list() { Some(cfg_meta) => { - debug2!("is cfg(...)"); + debug!("is cfg(...)"); do cfg_meta.iter().all |cfg_mi| { - debug2!("cfg({}[...])", cfg_mi.name()); + debug!("cfg({}[...])", cfg_mi.name()); match cfg_mi.node { ast::MetaList(s, ref not_cfgs) if "not" == s => { - debug2!("not!"); + debug!("not!"); // inside #[cfg(not(...))], so these need to all // not match. not_cfgs.iter().all(|mi| { - debug2!("cfg(not({}[...]))", mi.name()); + debug!("cfg(not({}[...]))", mi.name()); !contains(cfg, *mi) }) } @@ -309,7 +309,7 @@ pub fn test_cfg> false } }; - debug2!("test_cfg (no_cfgs={}, some_cfg_matches={})", no_cfgs, some_cfg_matches); + debug!("test_cfg (no_cfgs={}, some_cfg_matches={})", no_cfgs, some_cfg_matches); no_cfgs || some_cfg_matches } diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index de8f45c880d..5e4355161f4 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -374,7 +374,7 @@ impl CodeMap { for fm in self.files.iter() { if filename == fm.name { return *fm; } } //XXjdm the following triggers a mismatched type bug // (or expected function, found _|_) - fail2!(); // ("asking for " + filename + " which we don't know about"); + fail!(); // ("asking for " + filename + " which we don't know about"); } } @@ -393,7 +393,7 @@ impl CodeMap { } } if (a >= len) { - fail2!("position {} does not resolve to a source location", pos.to_uint()) + fail!("position {} does not resolve to a source location", pos.to_uint()) } return a; @@ -419,11 +419,11 @@ impl CodeMap { let chpos = self.bytepos_to_local_charpos(pos); let linebpos = f.lines[a]; let linechpos = self.bytepos_to_local_charpos(linebpos); - debug2!("codemap: byte pos {:?} is on the line at byte pos {:?}", + debug!("codemap: byte pos {:?} is on the line at byte pos {:?}", pos, linebpos); - debug2!("codemap: char pos {:?} is on the line at char pos {:?}", + debug!("codemap: char pos {:?} is on the line at char pos {:?}", chpos, linechpos); - debug2!("codemap: byte is on line: {:?}", line); + debug!("codemap: byte is on line: {:?}", line); assert!(chpos >= linechpos); return Loc { file: f, @@ -450,7 +450,7 @@ impl CodeMap { // Converts an absolute BytePos to a CharPos relative to the file it is // located in fn bytepos_to_local_charpos(&self, bpos: BytePos) -> CharPos { - debug2!("codemap: converting {:?} to char pos", bpos); + debug!("codemap: converting {:?} to char pos", bpos); let idx = self.lookup_filemap_idx(bpos); let map = self.files[idx]; @@ -458,7 +458,7 @@ impl CodeMap { let mut total_extra_bytes = 0; for mbc in map.multibyte_chars.iter() { - debug2!("codemap: {:?}-byte char at {:?}", mbc.bytes, mbc.pos); + debug!("codemap: {:?}-byte char at {:?}", mbc.bytes, mbc.pos); if mbc.pos < bpos { total_extra_bytes += mbc.bytes; // We should never see a byte position in the middle of a diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 4b5ab2fbb56..b38d4611535 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -69,7 +69,7 @@ struct CodemapT { impl span_handler for CodemapT { fn span_fatal(@mut self, sp: Span, msg: &str) -> ! { self.handler.emit(Some((self.cm, sp)), msg, fatal); - fail2!(); + fail!(); } fn span_err(@mut self, sp: Span, msg: &str) { self.handler.emit(Some((self.cm, sp)), msg, error); @@ -95,7 +95,7 @@ impl span_handler for CodemapT { impl handler for HandlerT { fn fatal(@mut self, msg: &str) -> ! { self.emit.emit(None, msg, fatal); - fail2!(); + fail!(); } fn err(@mut self, msg: &str) { self.emit.emit(None, msg, error); diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 78c4d6b6f4b..1f9fe28a46d 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -540,11 +540,11 @@ impl MapChain{ // names? I think not. // delaying implementing this.... pub fn each_key (&self, _f: &fn (&K)->bool) { - fail2!("unimplemented 2013-02-15T10:01"); + fail!("unimplemented 2013-02-15T10:01"); } pub fn each_value (&self, _f: &fn (&V) -> bool) { - fail2!("unimplemented 2013-02-15T10:02"); + fail!("unimplemented 2013-02-15T10:02"); } // Returns a copy of the value that the name maps to. @@ -587,7 +587,7 @@ impl MapChain{ if satisfies_pred(map,&n,pred) { map.insert(key,ext); } else { - fail2!("expected map chain containing satisfying frame") + fail!("expected map chain containing satisfying frame") } }, ConsMapChain (~ref mut map, rest) => { diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 620594a0a17..e1cc63fd0b8 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -429,7 +429,7 @@ fn insert_macro(exts: SyntaxEnv, name: ast::Name, transformer: @Transformer) { match t { &@BlockInfo(BlockInfo {macros_escape:false,_}) => true, &@BlockInfo(BlockInfo {_}) => false, - _ => fail2!("special identifier {:?} was bound to a non-BlockInfo", + _ => fail!("special identifier {:?} was bound to a non-BlockInfo", special_block_name) } }; @@ -741,7 +741,7 @@ pub fn expand_block_elts(exts: SyntaxEnv, b: &Block, fld: &MacroExpander) fn mustbesome(val : Option) -> T { match val { Some(v) => v, - None => fail2!("rename_fold returned None") + None => fail!("rename_fold returned None") } } @@ -749,7 +749,7 @@ fn mustbesome(val : Option) -> T { fn get_block_info(exts : SyntaxEnv) -> BlockInfo { match exts.find_in_topmost_frame(&intern(special_block_name)) { Some(@BlockInfo(bi)) => bi, - _ => fail2!("special identifier {:?} was bound to a non-BlockInfo", + _ => fail!("special identifier {:?} was bound to a non-BlockInfo", @" block") } } @@ -782,7 +782,7 @@ pub fn renames_to_fold(renames: @mut ~[(ast::Ident,ast::Name)]) -> @ast_fold { fn apply_pending_renames(folder : @ast_fold, stmt : ast::Stmt) -> @ast::Stmt { match folder.fold_stmt(&stmt) { Some(s) => s, - None => fail2!("renaming of stmt produced None") + None => fail!("renaming of stmt produced None") } } @@ -840,11 +840,11 @@ pub fn std_macros() -> @str { // NOTE (acrichto): remove these after the next snapshot macro_rules! log2( ($($arg:tt)*) => (log!($($arg)*)) ) - macro_rules! error2( ($($arg:tt)*) => (error!($($arg)*)) ) - macro_rules! warn2 ( ($($arg:tt)*) => (warn!($($arg)*)) ) - macro_rules! info2 ( ($($arg:tt)*) => (info!($($arg)*)) ) - macro_rules! debug2( ($($arg:tt)*) => (debug!($($arg)*)) ) - macro_rules! fail2( ($($arg:tt)*) => (fail!($($arg)*)) ) + macro_rules! error( ($($arg:tt)*) => (error!($($arg)*)) ) + macro_rules! warn ( ($($arg:tt)*) => (warn!($($arg)*)) ) + macro_rules! info ( ($($arg:tt)*) => (info!($($arg)*)) ) + macro_rules! debug( ($($arg:tt)*) => (debug!($($arg)*)) ) + macro_rules! fail( ($($arg:tt)*) => (fail!($($arg)*)) ) macro_rules! assert( ($cond:expr) => { @@ -873,7 +873,7 @@ pub fn std_macros() -> @str { // check both directions of equality.... if !((*given_val == *expected_val) && (*expected_val == *given_val)) { - fail2!(\"assertion failed: `(left == right) && (right == \ + fail!(\"assertion failed: `(left == right) && (right == \ left)` (left: `{:?}`, right: `{:?}`)\", *given_val, *expected_val); } @@ -893,7 +893,7 @@ pub fn std_macros() -> @str { given_val.approx_eq(&expected_val) && expected_val.approx_eq(&given_val) ) { - fail2!(\"left: {:?} does not approximately equal right: {:?}\", + fail!(\"left: {:?} does not approximately equal right: {:?}\", given_val, expected_val); } } @@ -910,7 +910,7 @@ pub fn std_macros() -> @str { given_val.approx_eq_eps(&expected_val, &epsilon_val) && expected_val.approx_eq_eps(&given_val, &epsilon_val) ) { - fail2!(\"left: {:?} does not approximately equal right: \ + fail!(\"left: {:?} does not approximately equal right: \ {:?} with epsilon: {:?}\", given_val, expected_val, epsilon_val); } @@ -945,7 +945,7 @@ pub fn std_macros() -> @str { */ macro_rules! unreachable (() => ( - fail2!(\"internal error: entered unreachable code\"); + fail!(\"internal error: entered unreachable code\"); )) macro_rules! condition ( @@ -1123,7 +1123,7 @@ pub fn inject_std_macros(parse_sess: @mut parse::ParseSess, ~[], parse_sess) { Some(item) => item, - None => fail2!("expected core macros to parse correctly") + None => fail!("expected core macros to parse correctly") }; let injector = @Injector { @@ -1381,16 +1381,16 @@ mod test { use util::parser_testing::{string_to_pat, string_to_tts, strs_to_idents}; use visit; - // make sure that fail2! is present + // make sure that fail! is present #[test] fn fail_exists_test () { - let src = @"fn main() { fail2!(\"something appropriately gloomy\");}"; + let src = @"fn main() { fail!(\"something appropriately gloomy\");}"; let sess = parse::new_parse_sess(None); let crate_ast = parse::parse_crate_from_source_str( @"", src, ~[],sess); let crate_ast = inject_std_macros(sess, ~[], crate_ast); - // don't bother with striping, doesn't affect fail2!. + // don't bother with striping, doesn't affect fail!. expand_crate(sess,~[],crate_ast); } @@ -1448,7 +1448,7 @@ mod test { cfg,~[],sess); match item_ast { Some(_) => (), // success - None => fail2!("expected this to parse") + None => fail!("expected this to parse") } } @@ -1487,7 +1487,7 @@ mod test { let marked_once_ctxt = match marked_once[0] { ast::tt_tok(_,token::IDENT(id,_)) => id.ctxt, - _ => fail2!(format!("unexpected shape for marked tts: {:?}",marked_once[0])) + _ => fail!(format!("unexpected shape for marked tts: {:?}",marked_once[0])) }; assert_eq!(mtwt_marksof(marked_once_ctxt,invalid_name),~[fm]); let remarked = mtwt_cancel_outer_mark(marked_once,marked_once_ctxt); @@ -1495,7 +1495,7 @@ mod test { match remarked[0] { ast::tt_tok(_,token::IDENT(id,_)) => assert_eq!(mtwt_marksof(id.ctxt,invalid_name),~[]), - _ => fail2!(format!("unexpected shape for marked tts: {:?}",remarked[0])) + _ => fail!(format!("unexpected shape for marked tts: {:?}",remarked[0])) } } @@ -1700,7 +1700,7 @@ foo_module!() bindings.iter().filter(|b|{@"xx" == (ident_to_str(*b))}).collect(); let cxbind = match cxbinds { [b] => b, - _ => fail2!("expected just one binding for ext_cx") + _ => fail!("expected just one binding for ext_cx") }; let resolved_binding = mtwt_resolve(*cxbind); // find all the xx varrefs: diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 4bef9601855..d10ec422987 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -255,8 +255,8 @@ pub mod rt { match res { Some(ast) => ast, None => { - error2!("Parse error with ```\n{}\n```", s); - fail2!() + error!("Parse error with ```\n{}\n```", s); + fail!() } } } @@ -490,7 +490,7 @@ fn mk_token(cx: @ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr { ~[mk_ident(cx, sp, ident)]); } - INTERPOLATED(_) => fail2!("quote! with interpolated token"), + INTERPOLATED(_) => fail!("quote! with interpolated token"), _ => () } @@ -528,7 +528,7 @@ fn mk_token(cx: @ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr { DOLLAR => "DOLLAR", UNDERSCORE => "UNDERSCORE", EOF => "EOF", - _ => fail2!() + _ => fail!() }; cx.expr_ident(sp, id_ext(name)) } @@ -553,7 +553,7 @@ fn mk_tt(cx: @ExtCtxt, sp: Span, tt: &ast::token_tree) } ast::tt_delim(ref tts) => mk_tts(cx, sp, **tts), - ast::tt_seq(*) => fail2!("tt_seq in quote!"), + ast::tt_seq(*) => fail!("tt_seq in quote!"), ast::tt_nonterminal(sp, ident) => { diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 7db64feb809..50688afc56a 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -122,7 +122,7 @@ pub struct MatcherPos { pub fn copy_up(mpu: &matcher_pos_up) -> ~MatcherPos { match *mpu { matcher_pos_up(Some(ref mp)) => (*mp).clone(), - _ => fail2!() + _ => fail!() } } @@ -387,7 +387,7 @@ pub fn parse( format!("{} ('{}')", ident_to_str(name), ident_to_str(bind)) } - _ => fail2!() + _ => fail!() } }).connect(" or "); return error(sp, format!( "Local ambiguity: multiple parsing options: \ @@ -412,7 +412,7 @@ pub fn parse( parse_nt(&rust_parser, ident_to_str(name)))); ei.idx += 1u; } - _ => fail2!() + _ => fail!() } cur_eis.push(ei); diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 84ff98b0188..37bc00d5827 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -891,7 +891,7 @@ mod test { let a_val = $a; let b_val = $b; if !(pred_val(a_val,b_val)) { - fail2!("expected args satisfying {}, got {:?} and {:?}", + fail!("expected args satisfying {}, got {:?} and {:?}", $predname, a_val, b_val); } } diff --git a/src/libsyntax/opt_vec.rs b/src/libsyntax/opt_vec.rs index ca93cbaea39..2000d0b9746 100644 --- a/src/libsyntax/opt_vec.rs +++ b/src/libsyntax/opt_vec.rs @@ -66,7 +66,7 @@ impl OptVec { pub fn get<'a>(&'a self, i: uint) -> &'a T { match *self { - Empty => fail2!("Invalid index {}", i), + Empty => fail!("Invalid index {}", i), Vec(ref v) => &v[i] } } diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index dba2f0b9417..a8132860b9b 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -32,7 +32,7 @@ impl parser_attr for Parser { fn parse_outer_attributes(&self) -> ~[ast::Attribute] { let mut attrs: ~[ast::Attribute] = ~[]; loop { - debug2!("parse_outer_attributes: self.token={:?}", + debug!("parse_outer_attributes: self.token={:?}", self.token); match *self.token { token::INTERPOLATED(token::nt_attr(*)) => { @@ -67,7 +67,7 @@ impl parser_attr for Parser { // if permit_inner is true, then a trailing `;` indicates an inner // attribute fn parse_attribute(&self, permit_inner: bool) -> ast::Attribute { - debug2!("parse_attributes: permit_inner={:?} self.token={:?}", + debug!("parse_attributes: permit_inner={:?} self.token={:?}", permit_inner, self.token); let (span, value) = match *self.token { INTERPOLATED(token::nt_attr(attr)) => { diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index f163bec7d4e..38921648a2b 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -134,7 +134,7 @@ pub fn strip_doc_comment_decoration(comment: &str) -> ~str { return lines.connect("\n"); } - fail2!("not a doc-comment: {}", comment); + fail!("not a doc-comment: {}", comment); } fn read_to_eol(rdr: @mut StringReader) -> ~str { @@ -161,7 +161,7 @@ fn consume_non_eol_whitespace(rdr: @mut StringReader) { } fn push_blank_line_comment(rdr: @mut StringReader, comments: &mut ~[cmnt]) { - debug2!(">>> blank-line comment"); + debug!(">>> blank-line comment"); let v: ~[~str] = ~[]; comments.push(cmnt {style: blank_line, lines: v, pos: rdr.last_pos}); } @@ -179,9 +179,9 @@ fn consume_whitespace_counting_blank_lines(rdr: @mut StringReader, fn read_shebang_comment(rdr: @mut StringReader, code_to_the_left: bool, comments: &mut ~[cmnt]) { - debug2!(">>> shebang comment"); + debug!(">>> shebang comment"); let p = rdr.last_pos; - debug2!("<<< shebang comment"); + debug!("<<< shebang comment"); comments.push(cmnt { style: if code_to_the_left { trailing } else { isolated }, lines: ~[read_one_line_comment(rdr)], @@ -191,19 +191,19 @@ fn read_shebang_comment(rdr: @mut StringReader, code_to_the_left: bool, fn read_line_comments(rdr: @mut StringReader, code_to_the_left: bool, comments: &mut ~[cmnt]) { - debug2!(">>> line comments"); + debug!(">>> line comments"); let p = rdr.last_pos; let mut lines: ~[~str] = ~[]; while rdr.curr == '/' && nextch(rdr) == '/' { let line = read_one_line_comment(rdr); - debug2!("{}", line); + debug!("{}", line); if is_doc_comment(line) { // doc-comments are not put in comments break; } lines.push(line); consume_non_eol_whitespace(rdr); } - debug2!("<<< line comments"); + debug!("<<< line comments"); if !lines.is_empty() { comments.push(cmnt { style: if code_to_the_left { trailing } else { isolated }, @@ -242,14 +242,14 @@ fn trim_whitespace_prefix_and_push_line(lines: &mut ~[~str], } None => s, }; - debug2!("pushing line: {}", s1); + debug!("pushing line: {}", s1); lines.push(s1); } fn read_block_comment(rdr: @mut StringReader, code_to_the_left: bool, comments: &mut ~[cmnt]) { - debug2!(">>> block comment"); + debug!(">>> block comment"); let p = rdr.last_pos; let mut lines: ~[~str] = ~[]; let col: CharPos = rdr.col; @@ -275,7 +275,7 @@ fn read_block_comment(rdr: @mut StringReader, } else { let mut level: int = 1; while level > 0 { - debug2!("=== block comment level {}", level); + debug!("=== block comment level {}", level); if is_eof(rdr) { (rdr as @mut reader).fatal(~"unterminated block comment"); } @@ -311,7 +311,7 @@ fn read_block_comment(rdr: @mut StringReader, if !is_eof(rdr) && rdr.curr != '\n' && lines.len() == 1u { style = mixed; } - debug2!("<<< block comment"); + debug!("<<< block comment"); comments.push(cmnt {style: style, lines: lines, pos: p}); } @@ -324,15 +324,15 @@ fn peeking_at_comment(rdr: @mut StringReader) -> bool { fn consume_comment(rdr: @mut StringReader, code_to_the_left: bool, comments: &mut ~[cmnt]) { - debug2!(">>> consume comment"); + debug!(">>> consume comment"); if rdr.curr == '/' && nextch(rdr) == '/' { read_line_comments(rdr, code_to_the_left, comments); } else if rdr.curr == '/' && nextch(rdr) == '*' { read_block_comment(rdr, code_to_the_left, comments); } else if rdr.curr == '#' && nextch(rdr) == '!' { read_shebang_comment(rdr, code_to_the_left, comments); - } else { fail2!(); } - debug2!("<<< consume comment"); + } else { fail!(); } + debug!("<<< consume comment"); } #[deriving(Clone)] @@ -378,11 +378,11 @@ pub fn gather_comments_and_literals(span_diagnostic: let TokenAndSpan {tok: tok, sp: sp} = rdr.peek(); if token::is_lit(&tok) { do with_str_from(rdr, bstart) |s| { - debug2!("tok lit: {}", s); + debug!("tok lit: {}", s); literals.push(lit {lit: s.to_owned(), pos: sp.lo}); } } else { - debug2!("tok: {}", token::to_str(get_ident_interner(), &tok)); + debug!("tok: {}", token::to_str(get_ident_interner(), &tok)); } first_read = false; } diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 8edc171fcac..7ac999c46a4 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -133,7 +133,7 @@ impl reader for TtReader { fn is_eof(@mut self) -> bool { self.cur_tok == token::EOF } fn next_token(@mut self) -> TokenAndSpan { let r = tt_next_token(self); - debug2!("TtReader: r={:?}", r); + debug!("TtReader: r={:?}", r); return r; } fn fatal(@mut self, m: ~str) -> ! { @@ -273,7 +273,7 @@ fn hex_digit_val(c: char) -> int { if in_range(c, '0', '9') { return (c as int) - ('0' as int); } if in_range(c, 'a', 'f') { return (c as int) - ('a' as int) + 10; } if in_range(c, 'A', 'F') { return (c as int) - ('A' as int) + 10; } - fail2!(); + fail!(); } fn bin_digit_value(c: char) -> int { if c == '0' { return 0; } return 1; } @@ -576,7 +576,7 @@ fn scan_number(c: char, rdr: @mut StringReader) -> token::Token { ~"int literal is too large") }; - debug2!("lexing {} as an unsuffixed integer literal", num_str); + debug!("lexing {} as an unsuffixed integer literal", num_str); return token::LIT_INT_UNSUFFIXED(parsed as i64); } } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 05998d80213..c9405d72464 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -417,18 +417,18 @@ mod test { _ => assert_eq!("wrong 4","correct") }, _ => { - error2!("failing value 3: {:?}",first_set); + error!("failing value 3: {:?}",first_set); assert_eq!("wrong 3","correct") } }, _ => { - error2!("failing value 2: {:?}",delim_elts); + error!("failing value 2: {:?}",delim_elts); assert_eq!("wrong","correct"); } }, _ => { - error2!("failing value: {:?}",tts); + error!("failing value: {:?}",tts); assert_eq!("wrong 1","correct"); } } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index c776e5bfd38..ed6019e1a55 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -448,7 +448,7 @@ impl Parser { // followed by some token from the set edible + inedible. Recover // from anticipated input errors, discarding erroneous characters. pub fn commit_expr(&self, e: @Expr, edible: &[token::Token], inedible: &[token::Token]) { - debug2!("commit_expr {:?}", e); + debug!("commit_expr {:?}", e); match e.node { ExprPath(*) => { // might be unit-struct construction; check for recoverableinput error. @@ -468,7 +468,7 @@ impl Parser { // followed by some token from the set edible + inedible. Check // for recoverable input errors, discarding erroneous characters. pub fn commit_stmt(&self, s: @Stmt, edible: &[token::Token], inedible: &[token::Token]) { - debug2!("commit_stmt {:?}", s); + debug!("commit_stmt {:?}", s); let _s = s; // unused, but future checks might want to inspect `s`. if self.last_token.as_ref().map_default(false, |t| is_ident_or_path(*t)) { let expected = vec::append(edible.to_owned(), inedible); @@ -933,13 +933,13 @@ impl Parser { }; let hi = p.last_span.hi; - debug2!("parse_trait_methods(): trait method signature ends in \ + debug!("parse_trait_methods(): trait method signature ends in \ `{}`", self.this_token_to_str()); match *p.token { token::SEMI => { p.bump(); - debug2!("parse_trait_methods(): parsing required method"); + debug!("parse_trait_methods(): parsing required method"); // NB: at the moment, visibility annotations on required // methods are ignored; this could change. if vis != ast::inherited { @@ -958,7 +958,7 @@ impl Parser { }) } token::LBRACE => { - debug2!("parse_trait_methods(): parsing provided method"); + debug!("parse_trait_methods(): parsing provided method"); let (inner_attrs, body) = p.parse_inner_attrs_and_block(); let attrs = vec::append(attrs, inner_attrs); @@ -1196,7 +1196,7 @@ impl Parser { _ => 0 }; - debug2!("parser is_named_argument offset:{}", offset); + debug!("parser is_named_argument offset:{}", offset); if offset == 0 { is_plain_ident_or_underscore(&*self.token) @@ -1212,7 +1212,7 @@ impl Parser { pub fn parse_arg_general(&self, require_name: bool) -> arg { let is_mutbl = self.eat_keyword(keywords::Mut); let pat = if require_name || self.is_named_argument() { - debug2!("parse_arg_general parse_pat (require_name:{:?})", + debug!("parse_arg_general parse_pat (require_name:{:?})", require_name); let pat = self.parse_pat(); @@ -1223,7 +1223,7 @@ impl Parser { self.expect(&token::COLON); pat } else { - debug2!("parse_arg_general ident_to_pat"); + debug!("parse_arg_general ident_to_pat"); ast_util::ident_to_pat(ast::DUMMY_NODE_ID, *self.last_span, special_idents::invalid) @@ -2470,7 +2470,7 @@ impl Parser { // There may be other types of expressions that can // represent the callee in `for` and `do` expressions // but they aren't represented by tests - debug2!("sugary call on {:?}", e.node); + debug!("sugary call on {:?}", e.node); self.span_fatal( e.span, format!("`{}` must be followed by a block call", keyword)); @@ -3916,7 +3916,7 @@ impl Parser { attrs = attrs_remaining + attrs; first = false; } - debug2!("parse_mod_items: parse_item_or_view_item(attrs={:?})", + debug!("parse_mod_items: parse_item_or_view_item(attrs={:?})", attrs); match self.parse_item_or_view_item(attrs, true /* macros allowed */) { @@ -4629,7 +4629,7 @@ impl Parser { let first_ident = self.parse_ident(); let mut path = ~[first_ident]; - debug2!("parsed view_path: {}", self.id_to_str(first_ident)); + debug!("parsed view_path: {}", self.id_to_str(first_ident)); match *self.token { token::EQ => { // x = foo::bar @@ -4837,7 +4837,7 @@ impl Parser { break; } iovi_foreign_item(_) => { - fail2!(); + fail!(); } } attrs = self.parse_outer_attributes(); @@ -4860,7 +4860,7 @@ impl Parser { items.push(item) } iovi_foreign_item(_) => { - fail2!(); + fail!(); } } } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index eae3e665b58..27747d94b66 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -219,8 +219,8 @@ pub fn to_str(input: @ident_interner, t: &Token) -> ~str { nt_block(*) => ~"block", nt_stmt(*) => ~"statement", nt_pat(*) => ~"pattern", - nt_attr(*) => fail2!("should have been handled"), - nt_expr(*) => fail2!("should have been handled above"), + nt_attr(*) => fail!("should have been handled"), + nt_expr(*) => fail!("should have been handled above"), nt_ty(*) => ~"type", nt_ident(*) => ~"identifier", nt_path(*) => ~"path", @@ -275,7 +275,7 @@ pub fn flip_delimiter(t: &token::Token) -> token::Token { RPAREN => LPAREN, RBRACE => LBRACE, RBRACKET => LBRACKET, - _ => fail2!() + _ => fail!() } } diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index 58d73ad687c..871584003b5 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -152,7 +152,7 @@ pub fn mk_printer(out: @io::Writer, linewidth: uint) -> @mut Printer { // Yes 3, it makes the ring buffers big enough to never // fall behind. let n: uint = 3 * linewidth; - debug2!("mk_printer {}", linewidth); + debug!("mk_printer {}", linewidth); let token: ~[token] = vec::from_elem(n, EOF); let size: ~[int] = vec::from_elem(n, 0); let scan_stack: ~[uint] = vec::from_elem(n, 0u); @@ -288,7 +288,7 @@ impl Printer { self.token[self.right] = t; } pub fn pretty_print(&mut self, t: token) { - debug2!("pp ~[{},{}]", self.left, self.right); + debug!("pp ~[{},{}]", self.left, self.right); match t { EOF => { if !self.scan_stack_empty { @@ -305,7 +305,7 @@ impl Printer { self.left = 0u; self.right = 0u; } else { self.advance_right(); } - debug2!("pp BEGIN({})/buffer ~[{},{}]", + debug!("pp BEGIN({})/buffer ~[{},{}]", b.offset, self.left, self.right); self.token[self.right] = t; self.size[self.right] = -self.right_total; @@ -313,10 +313,10 @@ impl Printer { } END => { if self.scan_stack_empty { - debug2!("pp END/print ~[{},{}]", self.left, self.right); + debug!("pp END/print ~[{},{}]", self.left, self.right); self.print(t, 0); } else { - debug2!("pp END/buffer ~[{},{}]", self.left, self.right); + debug!("pp END/buffer ~[{},{}]", self.left, self.right); self.advance_right(); self.token[self.right] = t; self.size[self.right] = -1; @@ -330,7 +330,7 @@ impl Printer { self.left = 0u; self.right = 0u; } else { self.advance_right(); } - debug2!("pp BREAK({})/buffer ~[{},{}]", + debug!("pp BREAK({})/buffer ~[{},{}]", b.offset, self.left, self.right); self.check_stack(0); self.scan_push(self.right); @@ -340,11 +340,11 @@ impl Printer { } STRING(s, len) => { if self.scan_stack_empty { - debug2!("pp STRING('{}')/print ~[{},{}]", + debug!("pp STRING('{}')/print ~[{},{}]", s, self.left, self.right); self.print(t, len); } else { - debug2!("pp STRING('{}')/buffer ~[{},{}]", + debug!("pp STRING('{}')/buffer ~[{},{}]", s, self.left, self.right); self.advance_right(); self.token[self.right] = t; @@ -356,14 +356,14 @@ impl Printer { } } pub fn check_stream(&mut self) { - debug2!("check_stream ~[{}, {}] with left_total={}, right_total={}", + debug!("check_stream ~[{}, {}] with left_total={}, right_total={}", self.left, self.right, self.left_total, self.right_total); if self.right_total - self.left_total > self.space { - debug2!("scan window is {}, longer than space on line ({})", + debug!("scan window is {}, longer than space on line ({})", self.right_total - self.left_total, self.space); if !self.scan_stack_empty { if self.left == self.scan_stack[self.bottom] { - debug2!("setting {} to infinity and popping", self.left); + debug!("setting {} to infinity and popping", self.left); self.size[self.scan_pop_bottom()] = size_infinity; } } @@ -372,7 +372,7 @@ impl Printer { } } pub fn scan_push(&mut self, x: uint) { - debug2!("scan_push {}", x); + debug!("scan_push {}", x); if self.scan_stack_empty { self.scan_stack_empty = false; } else { @@ -408,7 +408,7 @@ impl Printer { assert!((self.right != self.left)); } pub fn advance_left(&mut self, x: token, L: int) { - debug2!("advnce_left ~[{},{}], sizeof({})={}", self.left, self.right, + debug!("advnce_left ~[{},{}], sizeof({})={}", self.left, self.right, self.left, L); if L >= 0 { self.print(x, L); @@ -451,13 +451,13 @@ impl Printer { } } pub fn print_newline(&mut self, amount: int) { - debug2!("NEWLINE {}", amount); + debug!("NEWLINE {}", amount); (*self.out).write_str("\n"); self.pending_indentation = 0; self.indent(amount); } pub fn indent(&mut self, amount: int) { - debug2!("INDENT {}", amount); + debug!("INDENT {}", amount); self.pending_indentation += amount; } pub fn get_top(&mut self) -> print_stack_elt { @@ -480,9 +480,9 @@ impl Printer { (*self.out).write_str(s); } pub fn print(&mut self, x: token, L: int) { - debug2!("print {} {} (remaining line space={})", tok_str(x), L, + debug!("print {} {} (remaining line space={})", tok_str(x), L, self.space); - debug2!("{}", buf_str(self.token.clone(), + debug!("{}", buf_str(self.token.clone(), self.size.clone(), self.left, self.right, @@ -491,13 +491,13 @@ impl Printer { BEGIN(b) => { if L > self.space { let col = self.margin - self.space + b.offset; - debug2!("print BEGIN -> push broken block at col {}", col); + debug!("print BEGIN -> push broken block at col {}", col); self.print_stack.push(print_stack_elt { offset: col, pbreak: broken(b.breaks) }); } else { - debug2!("print BEGIN -> push fitting block"); + debug!("print BEGIN -> push fitting block"); self.print_stack.push(print_stack_elt { offset: 0, pbreak: fits @@ -505,7 +505,7 @@ impl Printer { } } END => { - debug2!("print END -> pop END"); + debug!("print END -> pop END"); let print_stack = &mut *self.print_stack; assert!((print_stack.len() != 0u)); print_stack.pop(); @@ -514,24 +514,24 @@ impl Printer { let top = self.get_top(); match top.pbreak { fits => { - debug2!("print BREAK({}) in fitting block", b.blank_space); + debug!("print BREAK({}) in fitting block", b.blank_space); self.space -= b.blank_space; self.indent(b.blank_space); } broken(consistent) => { - debug2!("print BREAK({}+{}) in consistent block", + debug!("print BREAK({}+{}) in consistent block", top.offset, b.offset); self.print_newline(top.offset + b.offset); self.space = self.margin - (top.offset + b.offset); } broken(inconsistent) => { if L > self.space { - debug2!("print BREAK({}+{}) w/ newline in inconsistent", + debug!("print BREAK({}+{}) w/ newline in inconsistent", top.offset, b.offset); self.print_newline(top.offset + b.offset); self.space = self.margin - (top.offset + b.offset); } else { - debug2!("print BREAK({}) w/o newline in inconsistent", + debug!("print BREAK({}) w/o newline in inconsistent", b.blank_space); self.indent(b.blank_space); self.space -= b.blank_space; @@ -540,7 +540,7 @@ impl Printer { } } STRING(s, len) => { - debug2!("print STRING({})", s); + debug!("print STRING({})", s); assert_eq!(L, len); // assert!(L <= space); self.space -= len; @@ -548,7 +548,7 @@ impl Printer { } EOF => { // EOF should never get here. - fail2!(); + fail!(); } } } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 0d442dca9b6..b245bd75ace 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -453,10 +453,10 @@ pub fn print_type(s: @ps, ty: &ast::Ty) { word(s.s, ")"); } ast::ty_mac(_) => { - fail2!("print_type doesn't know how to print a ty_mac"); + fail!("print_type doesn't know how to print a ty_mac"); } ast::ty_infer => { - fail2!("print_type shouldn't see a ty_infer"); + fail!("print_type shouldn't see a ty_infer"); } } @@ -701,7 +701,7 @@ pub fn print_struct(s: @ps, popen(s); do commasep(s, inconsistent, struct_def.fields) |s, field| { match field.node.kind { - ast::named_field(*) => fail2!("unexpected named field"), + ast::named_field(*) => fail!("unexpected named field"), ast::unnamed_field => { maybe_print_comment(s, field.span.lo); print_type(s, &field.node.ty); @@ -720,7 +720,7 @@ pub fn print_struct(s: @ps, for field in struct_def.fields.iter() { match field.node.kind { - ast::unnamed_field => fail2!("unexpected unnamed field"), + ast::unnamed_field => fail!("unexpected unnamed field"), ast::named_field(ident, visibility) => { hardbreak_if_not_bol(s); maybe_print_comment(s, field.span.lo); @@ -1009,7 +1009,7 @@ pub fn print_if(s: @ps, test: &ast::Expr, blk: &ast::Block, } // BLEAH, constraints would be great here _ => { - fail2!("print_if saw if with weird alternative"); + fail!("print_if saw if with weird alternative"); } } } @@ -1311,7 +1311,7 @@ pub fn print_expr(s: @ps, expr: &ast::Expr) { } end(s); // close enclosing cbox } - None => fail2!() + None => fail!() } } else { // the block will close the pattern's ibox @@ -2304,7 +2304,7 @@ mod test { fn string_check (given : &T, expected: &T) { if !(given == expected) { - fail2!("given {:?}, expected {:?}", given, expected); + fail!("given {:?}, expected {:?}", given, expected); } } -- cgit 1.4.1-3-g733a5