From b2bcb7229a4bce0c9459807552d071eb2b2c9a0e Mon Sep 17 00:00:00 2001 From: Phil Dawes Date: Sat, 28 Mar 2015 21:58:51 +0000 Subject: 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 --- src/libsyntax/parse/lexer/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libsyntax/parse/lexer') diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 78470f00207..22b7d5c9f1d 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -116,7 +116,7 @@ impl<'a> Reader for TtReader<'a> { r } fn fatal(&self, m: &str) -> ! { - self.sp_diag.span_fatal(self.cur_span, m); + panic!(self.sp_diag.span_fatal(self.cur_span, m)); } fn err(&self, m: &str) { self.sp_diag.span_err(self.cur_span, m); @@ -181,7 +181,7 @@ impl<'a> StringReader<'a> { /// Report a fatal lexical error with a given span. pub fn fatal_span(&self, sp: Span, m: &str) -> ! { - self.span_diagnostic.span_fatal(sp, m) + panic!(self.span_diagnostic.span_fatal(sp, m)) } /// Report a lexical error with a given span. -- cgit 1.4.1-3-g733a5