Split Handler::emit_diagnostic
in two.
Currently, `emit_diagnostic` takes `&mut self`. This commit changes it so `emit_diagnostic` takes `self` and the new `emit_diagnostic_without_consuming` function takes `&mut self`. I find the distinction useful. The former case is much more common, and avoids a bunch of `mut` and `&mut` occurrences. We can also restrict the latter with `pub(crate)` which is nice.
This commit is contained in:
parent
2c2c7f13a6
commit
9a78412511
12 changed files with 64 additions and 45 deletions
|
@ -51,8 +51,8 @@ macro_rules! panictry_buffer {
|
|||
match $e {
|
||||
Ok(e) => e,
|
||||
Err(errs) => {
|
||||
for mut e in errs {
|
||||
$handler.emit_diagnostic(&mut e);
|
||||
for e in errs {
|
||||
$handler.emit_diagnostic(e);
|
||||
}
|
||||
FatalError.raise()
|
||||
}
|
||||
|
@ -165,8 +165,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(mut d) => {
|
||||
sess.span_diagnostic.emit_diagnostic(&mut d);
|
||||
Err(d) => {
|
||||
sess.span_diagnostic.emit_diagnostic(d);
|
||||
FatalError.raise();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue