1
Fork 0

Work towards a non-panicing parser (libsyntax)

- Functions in parser.rs return PResult<> rather than panicing
- Other functions in libsyntax call panic! explicitly for now if they rely on panicing behaviour.
- 'panictry!' macro added as scaffolding while converting panicing functions.
  (This does the same as 'unwrap()' but is easier to grep for and turn into try!())
- Leaves panicing wrappers for the following functions so that the
  quote_* macros behave the same:
  - parse_expr, parse_item, parse_pat, parse_arm, parse_ty, parse_stmt
This commit is contained in:
Phil Dawes 2015-03-28 21:58:51 +00:00
parent f73f3233f1
commit b2bcb7229a
23 changed files with 1412 additions and 1315 deletions

View file

@ -125,7 +125,7 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
match i.node {
ast::ItemFn(_, ast::Unsafety::Unsafe, _, _, _) => {
let diag = self.cx.span_diagnostic;
diag.span_fatal(i.span, "unsafe functions cannot be used for tests");
panic!(diag.span_fatal(i.span, "unsafe functions cannot be used for tests"));
}
_ => {
debug!("this is a test function");