Skip to content

Commit

Permalink
Don't ignore parse error when constructing report
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanewok committed Dec 13, 2018
1 parent a2042a6 commit c7ee2a2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ fn format_project<T: FormatHandler>(
let source_map = Rc::new(SourceMap::new(FilePathMapping::empty()));
let mut parse_session = make_parse_sess(source_map.clone(), config);
let mut report = FormatReport::new();
let krate = parse_crate(input, &parse_session, config, &mut report)?;
let krate = match parse_crate(input, &parse_session, config, &mut report) {
Ok(krate) => krate,
// Surface parse error via Session (errors are merged there from report)
Err(ErrorKind::ParseError) => return Ok(report),
Err(e) => return Err(e),
};
timer = timer.done_parsing();

// Suppress error output if we have to do any further parsing.
Expand Down

0 comments on commit c7ee2a2

Please sign in to comment.