Take &mut Diagnostic in emit_diagnostic.

Taking a Diagnostic by move would break the usual pattern
`diag.label(..).emit()`.
This commit is contained in:
Camille GILLOT
2022-03-20 18:26:09 +01:00
parent 4767ccec93
commit 056951d628
13 changed files with 43 additions and 41 deletions

View File

@@ -49,8 +49,8 @@ macro_rules! panictry_buffer {
match $e {
Ok(e) => e,
Err(errs) => {
for e in errs {
$handler.emit_diagnostic(&e);
for mut e in errs {
$handler.emit_diagnostic(&mut e);
}
FatalError.raise()
}
@@ -167,8 +167,8 @@ fn try_file_to_source_file(
fn file_to_source_file(sess: &ParseSess, path: &Path, spanopt: Option<Span>) -> Lrc<SourceFile> {
match try_file_to_source_file(sess, path, spanopt) {
Ok(source_file) => source_file,
Err(d) => {
sess.span_diagnostic.emit_diagnostic(&d);
Err(mut d) => {
sess.span_diagnostic.emit_diagnostic(&mut d);
FatalError.raise();
}
}