about summary refs log tree commit diff
path: root/src/libsyntax/ext/expand.rs
diff options
context:
space:
mode:
authorPhil Dawes <phil@phildawes.net>2015-03-28 21:58:51 +0000
committerPhil Dawes <phil@phildawes.net>2015-04-05 09:52:50 +0100
commitb2bcb7229a4bce0c9459807552d071eb2b2c9a0e (patch)
treef08ef63bff0abde2d9bcce4eb751681df21b9b98 /src/libsyntax/ext/expand.rs
parentf73f3233f10e506ec41c17126e66953ed6996feb (diff)
downloadrust-b2bcb7229a4bce0c9459807552d071eb2b2c9a0e.tar.gz
rust-b2bcb7229a4bce0c9459807552d071eb2b2c9a0e.zip
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
Diffstat (limited to 'src/libsyntax/ext/expand.rs')
-rw-r--r--src/libsyntax/ext/expand.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 94abc0b34bc..f13047d3725 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -1684,7 +1684,7 @@ mod test {
 
     fn expand_crate_str(crate_str: String) -> ast::Crate {
         let ps = parse::new_parse_sess();
-        let crate_ast = string_to_parser(&ps, crate_str).parse_crate_mod();
+        let crate_ast = panictry!(string_to_parser(&ps, crate_str).parse_crate_mod());
         // the cfg argument actually does matter, here...
         expand_crate(&ps,test_ecfg(),vec!(),vec!(),crate_ast)
     }