auto merge of #17894 : steveklabnik/rust/fail_to_panic, r=aturon
This in-progress PR implements https://github.com/rust-lang/rust/issues/17489. I made the code changes in this commit, next is to go through alllllllll the documentation and fix various things. - Rename column headings as appropriate, `# Panics` for panic conditions and `# Errors` for `Result`s. - clean up usage of words like 'fail' in error messages Anything else to add to the list, @aturon ? I think I should leave the actual functions with names like `slice_or_fail` alone, since you'll get to those in your conventions work? I'm submitting just the code bits now so that we can see it separately, and I also don't want to have to keep re-building rust over and over again if I don't have to 😉 Listing all the bits so I can remember as I go: - [x] compiler-rt - [x] compiletest - [x] doc - [x] driver - [x] etc - [x] grammar - [x] jemalloc - [x] liballoc - [x] libarena - [x] libbacktrace - [x] libcollections - [x] libcore - [x] libcoretest - [x] libdebug - [x] libflate - [x] libfmt_macros - [x] libfourcc - [x] libgetopts - [x] libglob - [x] libgraphviz - [x] libgreen - [x] libhexfloat - [x] liblibc - [x] liblog - [x] libnative - [x] libnum - [x] librand - [x] librbml - [x] libregex - [x] libregex_macros - [x] librlibc - [x] librustc - [x] librustc_back - [x] librustc_llvm - [x] librustdoc - [x] librustrt - [x] libsemver - [x] libserialize - [x] libstd - [x] libsync - [x] libsyntax - [x] libterm - [x] libtest - [x] libtime - [x] libunicode - [x] liburl - [x] libuuid - [x] llvm - [x] rt - [x] test
This commit is contained in:
@@ -117,7 +117,7 @@ impl BuildAst {
|
||||
fn flags(&self) -> Flags {
|
||||
match *self {
|
||||
Paren(flags, _, _) => flags,
|
||||
_ => fail!("Cannot get flags from {}", self),
|
||||
_ => panic!("Cannot get flags from {}", self),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ impl BuildAst {
|
||||
match *self {
|
||||
Paren(_, 0, _) => None,
|
||||
Paren(_, c, _) => Some(c),
|
||||
_ => fail!("Cannot get capture group from {}", self),
|
||||
_ => panic!("Cannot get capture group from {}", self),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ impl BuildAst {
|
||||
Some(name.clone())
|
||||
}
|
||||
}
|
||||
_ => fail!("Cannot get capture name from {}", self),
|
||||
_ => panic!("Cannot get capture name from {}", self),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ impl BuildAst {
|
||||
fn unwrap(self) -> Result<Ast, Error> {
|
||||
match self {
|
||||
Expr(x) => Ok(x),
|
||||
_ => fail!("Tried to unwrap non-AST item: {}", self),
|
||||
_ => panic!("Tried to unwrap non-AST item: {}", self),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -321,7 +321,7 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
let rep: Repeater = match c {
|
||||
'?' => ZeroOne, '*' => ZeroMore, '+' => OneMore,
|
||||
_ => fail!("Not a valid repeater operator."),
|
||||
_ => panic!("Not a valid repeater operator."),
|
||||
};
|
||||
|
||||
match self.peek(1) {
|
||||
@@ -389,7 +389,7 @@ impl<'a> Parser<'a> {
|
||||
continue
|
||||
}
|
||||
Some(ast) =>
|
||||
fail!("Expected Class AST but got '{}'", ast),
|
||||
panic!("Expected Class AST but got '{}'", ast),
|
||||
// Just drop down and try to add as a regular character.
|
||||
None => {},
|
||||
},
|
||||
@@ -404,7 +404,7 @@ impl<'a> Parser<'a> {
|
||||
return self.err(
|
||||
"\\A, \\z, \\b and \\B are not valid escape \
|
||||
sequences inside a character class."),
|
||||
ast => fail!("Unexpected AST item '{}'", ast),
|
||||
ast => panic!("Unexpected AST item '{}'", ast),
|
||||
}
|
||||
}
|
||||
']' if ranges.len() > 0 || alts.len() > 0 => {
|
||||
|
||||
Reference in New Issue
Block a user