diff options
| author | bors <bors@rust-lang.org> | 2013-02-13 17:11:08 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-02-13 17:11:08 -0800 |
| commit | 0ae74bef188fe4f1fff69c0fa85d308c40bce7f8 (patch) | |
| tree | f5258cb43faeb5f36f816e4a2d04442c987423b4 /src/libsyntax | |
| parent | c51ecc3223ed64b7948f40097c5083da0c201811 (diff) | |
| parent | 4445b38df27777b043cad9ecc2452daad3469949 (diff) | |
| download | rust-0ae74bef188fe4f1fff69c0fa85d308c40bce7f8.tar.gz rust-0ae74bef188fe4f1fff69c0fa85d308c40bce7f8.zip | |
auto merge of #4905 : brson/rust/issue4524, r=brson
Rebase of #4895
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ast_map.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ast_util.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/attr.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/codemap.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/diagnostic.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/auto_encode.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/parse_proto.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/parse/comments.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/print/pp.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 16 | ||||
| -rw-r--r-- | src/libsyntax/util/testing.rs | 4 |
18 files changed, 47 insertions, 47 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index b109333c3b5..949e9ff447c 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -37,7 +37,7 @@ pub impl<S: Encoder> ident: Encodable<S> { let intr = match unsafe { task::local_data::local_data_get(interner_key!()) } { - None => die!(~"encode: TLS interner not set up"), + None => fail!(~"encode: TLS interner not set up"), Some(intr) => intr }; @@ -50,7 +50,7 @@ pub impl<D: Decoder> ident: Decodable<D> { let intr = match unsafe { task::local_data::local_data_get(interner_key!()) } { - None => die!(~"decode: TLS interner not set up"), + None => fail!(~"decode: TLS interner not set up"), Some(intr) => intr }; diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 8be4b219ded..9eeee943f8b 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -320,7 +320,7 @@ pub fn map_struct_def(struct_def: @ast::struct_def, parent_node: ast_node, cx.map.insert(ctor_id, node_struct_ctor(struct_def, item, p)); } - _ => die!(~"struct def parent wasn't an item") + _ => fail!(~"struct def parent wasn't an item") } } } @@ -404,7 +404,7 @@ pub fn node_item_query<Result>(items: map, id: node_id, error_msg: ~str) -> Result { match items.find(&id) { Some(node_item(it, _)) => query(it), - _ => die!(error_msg) + _ => fail!(error_msg) } } diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index c659d6d6020..335dd4e3fa2 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -44,7 +44,7 @@ pub pure fn stmt_id(s: stmt) -> node_id { stmt_decl(_, id) => id, stmt_expr(_, id) => id, stmt_semi(_, id) => id, - stmt_mac(*) => die!(~"attempted to analyze unexpanded stmt") + stmt_mac(*) => fail!(~"attempted to analyze unexpanded stmt") } } @@ -53,7 +53,7 @@ pub fn variant_def_ids(d: def) -> {enm: def_id, var: def_id} { def_variant(enum_id, var_id) => { return {enm: enum_id, var: var_id} } - _ => die!(~"non-variant in variant_def_ids") + _ => fail!(~"non-variant in variant_def_ids") } } @@ -71,7 +71,7 @@ pub pure fn def_id_of_def(d: def) -> def_id { local_def(id) } - def_prim_ty(_) => die!() + def_prim_ty(_) => fail!() } } diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index d258393e3b9..22f1e2d4753 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -198,7 +198,7 @@ fn eq(a: @ast::meta_item, b: @ast::meta_item) -> bool { // FIXME (#607): Needs implementing // This involves probably sorting the list by name and // meta_item variant - die!(~"unimplemented meta_item variant") + fail!(~"unimplemented meta_item variant") } } } diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index a509325face..b41e84a04f8 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -401,7 +401,7 @@ pub impl CodeMap { for self.files.each |fm| { if fm.name == filename { return *fm; } } //XXjdm the following triggers a mismatched type bug // (or expected function, found _|_) - die!(); // ("asking for " + filename + " which we don't know about"); + fail!(); // ("asking for " + filename + " which we don't know about"); } } @@ -421,7 +421,7 @@ priv impl CodeMap { } } if (a >= len) { - die!(fmt!("position %u does not resolve to a source location", + fail!(fmt!("position %u does not resolve to a source location", pos.to_uint())) } diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 51ef085839d..e44ee4eef0a 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -66,7 +66,7 @@ struct CodemapT { impl CodemapT: span_handler { fn span_fatal(@mut self, sp: span, msg: &str) -> ! { self.handler.emit(Some((self.cm, sp)), msg, fatal); - die!(); + fail!(); } fn span_err(@mut self, sp: span, msg: &str) { self.handler.emit(Some((self.cm, sp)), msg, error); @@ -92,7 +92,7 @@ impl CodemapT: span_handler { impl HandlerT: handler { fn fatal(@mut self, msg: &str) -> ! { (self.emit)(None, msg, fatal); - die!(); + fail!(); } fn err(@mut self, msg: &str) { (self.emit)(None, msg, error); diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs index acbe4d7fa23..c854fca6424 100644 --- a/src/libsyntax/ext/auto_encode.rs +++ b/src/libsyntax/ext/auto_encode.rs @@ -812,7 +812,7 @@ fn mk_struct_fields(fields: ~[@ast::struct_field]) -> ~[field] { do fields.map |field| { let (ident, mutbl) = match field.node.kind { ast::named_field(ident, mutbl, _) => (ident, mutbl), - _ => die!(~"[auto_encode] does not support \ + _ => fail!(~"[auto_encode] does not support \ unnamed fields") }; @@ -954,9 +954,9 @@ fn mk_enum_ser_body( ast::tuple_variant_kind(args) => ser_variant(cx, span, variant.node.name, v_idx, args), ast::struct_variant_kind(*) => - die!(~"struct variants unimplemented"), + fail!(~"struct variants unimplemented"), ast::enum_variant_kind(*) => - die!(~"enum variants unimplemented"), + fail!(~"enum variants unimplemented"), } }; @@ -1047,9 +1047,9 @@ fn mk_enum_deser_body( } }, ast::struct_variant_kind(*) => - die!(~"struct variants unimplemented"), + fail!(~"struct variants unimplemented"), ast::enum_variant_kind(*) => - die!(~"enum variants unimplemented") + fail!(~"enum variants unimplemented") }; let pat = @ast::pat { diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 18256369c78..17197f64c55 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -292,7 +292,7 @@ pub fn core_macros() -> ~str { ::core::sys::begin_unwind($msg, file!().to_owned(), line!()) ); () => ( - die!(~\"explicit failure\") + fail!(~\"explicit failure\") ) ) @@ -301,14 +301,14 @@ pub fn core_macros() -> ~str { ::core::sys::begin_unwind($msg, file!().to_owned(), line!()) ); () => ( - die!(~\"explicit failure\") + fail!(~\"explicit failure\") ) ) macro_rules! fail_unless( ($cond:expr) => { if !$cond { - die!(~\"assertion failed: \" + stringify!($cond)) + fail!(~\"assertion failed: \" + stringify!($cond)) } } ) diff --git a/src/libsyntax/ext/pipes/parse_proto.rs b/src/libsyntax/ext/pipes/parse_proto.rs index 1502332859c..6a1708b8e2b 100644 --- a/src/libsyntax/ext/pipes/parse_proto.rs +++ b/src/libsyntax/ext/pipes/parse_proto.rs @@ -40,13 +40,13 @@ pub impl parser::Parser: proto_parser { self.expect(token::COLON); let dir = match copy self.token { token::IDENT(n, _) => self.interner.get(n), - _ => die!() + _ => fail!() }; self.bump(); let dir = match dir { @~"send" => send, @~"recv" => recv, - _ => die!() + _ => fail!() }; let typarms = if self.token == token::LT { diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 4a9a22de50f..4522c7e0fd6 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -184,7 +184,7 @@ pub mod rt { Some(ast) => ast, None => { error!("Parse error with ```\n%s\n```", s); - die!() + fail!() } } } @@ -399,7 +399,7 @@ fn mk_token(cx: ext_ctxt, sp: span, tok: token::Token) -> @ast::expr { ~[mk_ident(cx, sp, ident)]); } - INTERPOLATED(_) => die!(~"quote! with interpolated token"), + INTERPOLATED(_) => fail!(~"quote! with interpolated token"), _ => () } @@ -437,7 +437,7 @@ fn mk_token(cx: ext_ctxt, sp: span, tok: token::Token) -> @ast::expr { DOLLAR => "DOLLAR", UNDERSCORE => "UNDERSCORE", EOF => "EOF", - _ => die!() + _ => fail!() }; build::mk_path(cx, sp, ids_ext(cx, ~[name.to_owned()])) @@ -467,7 +467,7 @@ fn mk_tt(cx: ext_ctxt, sp: span, tt: &ast::token_tree) } ast::tt_delim(ref tts) => mk_tts(cx, sp, *tts), - ast::tt_seq(*) => die!(~"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 4b1194bb5f1..9e89e703c09 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -124,7 +124,7 @@ pub type matcher_pos = ~{ pub fn copy_up(&& mpu: matcher_pos_up) -> matcher_pos { match &mpu { &matcher_pos_up(Some(ref mp)) => copy (*mp), - _ => die!() + _ => fail!() } } @@ -361,7 +361,7 @@ pub fn parse(sess: parse_sess, fmt!("%s ('%s')", *sess.interner.get(name), *sess.interner.get(bind)) } - _ => die!() + _ => fail!() } }), ~" or "); return error(sp, fmt!( "Local ambiguity: multiple parsing options: \ @@ -386,7 +386,7 @@ pub fn parse(sess: parse_sess, parse_nt(rust_parser, *sess.interner.get(name)))); ei.idx += 1u; } - _ => die!() + _ => fail!() } cur_eis.push(move ei); diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index a8db06fe085..1e17cf3543d 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -117,7 +117,7 @@ pub fn strip_doc_comment_decoration(comment: ~str) -> ~str { return str::connect(lines, ~"\n"); } - die!(~"not a doc-comment: " + comment); + fail!(~"not a doc-comment: " + comment); } fn read_to_eol(rdr: @mut StringReader) -> ~str { @@ -297,7 +297,7 @@ fn consume_comment(rdr: @mut StringReader, 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 { die!(); } + } else { fail!(); } debug!("<<< consume comment"); } diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index e8afd0b96a2..48ba94bdc33 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -215,7 +215,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; } - die!(); + fail!(); } fn bin_digit_value(c: char) -> int { if c == '0' { return 0; } return 1; } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 6382413b081..1fcd99e1946 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2538,7 +2538,7 @@ pub impl Parser { _ => None } } - _ => die!() + _ => fail!() }; match maybe_bound { @@ -3907,7 +3907,7 @@ pub impl Parser { let metadata = self.parse_optional_meta(); view_item_use(ident, metadata, self.get_id()) } else { - die!(); + fail!(); }; self.expect(token::SEMI); @ast::view_item { node: node, diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index b8d756d893a..dbcb3d756c8 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -210,7 +210,7 @@ pub fn to_str(in: @ident_interner, t: Token) -> ~str { nt_block(*) => ~"block", nt_stmt(*) => ~"statement", nt_pat(*) => ~"pattern", - nt_expr(*) => die!(~"should have been handled above"), + nt_expr(*) => fail!(~"should have been handled above"), nt_ty(*) => ~"type", nt_ident(*) => ~"identifier", nt_path(*) => ~"path", @@ -263,7 +263,7 @@ pub fn flip_delimiter(t: token::Token) -> token::Token { token::RPAREN => token::LPAREN, token::RBRACE => token::LBRACE, token::RBRACKET => token::LBRACKET, - _ => die!() + _ => fail!() } } diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index 4b9767ca6c8..aeebcce1f2b 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -519,7 +519,7 @@ pub impl Printer { } EOF => { // EOF should never get here. - die!(); + fail!(); } } } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 7a60696c0a2..b05461aa8d9 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -440,10 +440,10 @@ pub fn print_type_ex(s: @ps, &&ty: @ast::Ty, print_colons: bool) { word(s.s, ~"]"); } ast::ty_mac(_) => { - die!(~"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 => { - die!(~"print_type shouldn't see a ty_infer"); + fail!(~"print_type shouldn't see a ty_infer"); } } @@ -637,7 +637,7 @@ pub fn print_enum_def(s: @ps, enum_definition: ast::enum_def, word_space(s, ~"="); match enum_definition.variants[0].node.kind { ast::tuple_variant_kind(args) => print_type(s, args[0].ty), - _ => die!(~"newtype syntax with struct?") + _ => fail!(~"newtype syntax with struct?") } word(s.s, ~";"); end(s); @@ -706,7 +706,7 @@ pub fn print_struct(s: @ps, } match field.node.kind { - ast::named_field(*) => die!(~"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); @@ -729,7 +729,7 @@ pub fn print_struct(s: @ps, for struct_def.fields.each |field| { match field.node.kind { - ast::unnamed_field => die!(~"unexpected unnamed field"), + ast::unnamed_field => fail!(~"unexpected unnamed field"), ast::named_field(ident, mutability, visibility) => { hardbreak_if_not_bol(s); maybe_print_comment(s, field.span.lo); @@ -1015,7 +1015,7 @@ pub fn print_if(s: @ps, test: @ast::expr, blk: ast::blk, } // BLEAH, constraints would be great here _ => { - die!(~"print_if saw if with weird alternative"); + fail!(~"print_if saw if with weird alternative"); } } } @@ -1316,7 +1316,7 @@ pub fn print_expr(s: @ps, &&expr: @ast::expr) { } end(s); // close enclosing cbox } - None => die!() + None => fail!() } } else { // the block will close the pattern's ibox @@ -2257,7 +2257,7 @@ pub mod test { fn string_check<T : Eq> (given : &T, expected: &T) { if !(given == expected) { - die!(fmt!("given %?, expected %?",given,expected)); + fail!(fmt!("given %?, expected %?",given,expected)); } } diff --git a/src/libsyntax/util/testing.rs b/src/libsyntax/util/testing.rs index 39d3b003e66..b6d333349a0 100644 --- a/src/libsyntax/util/testing.rs +++ b/src/libsyntax/util/testing.rs @@ -13,12 +13,12 @@ use core::cmp; pub pure fn check_equal_ptr<T : cmp::Eq> (given : &T, expected: &T) { if !((given == expected) && (expected == given )) { - die!(fmt!("given %?, expected %?",given,expected)); + fail!(fmt!("given %?, expected %?",given,expected)); } } pub pure fn check_equal<T : cmp::Eq> (given : T, expected: T) { if !((given == expected) && (expected == given )) { - die!(fmt!("given %?, expected %?",given,expected)); + fail!(fmt!("given %?, expected %?",given,expected)); } } |
