Don't ignore parse error when constructing report
This commit is contained in:
parent
a2042a6470
commit
c7ee2a2857
1 changed files with 6 additions and 1 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue