diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/lib.rs b/src/lib.rs index 12258ada15c..69f9aaebbb7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -392,12 +392,17 @@ fn parse_input(input: Input, } }; - // Bail out if the parser recovered from an error. - if parse_session.span_diagnostic.has_errors() { - return Err(None); + match result { + Ok(c) => { + if parse_session.span_diagnostic.has_errors() { + // Bail out if the parser recovered from an error. + Err(None) + } else { + Ok(c) + } + } + Err(e) => Err(Some(e)), } - - result.map_err(|e| Some(e)) } pub fn format_input<T: Write>(input: Input, |
