rustc_error: make ErrorReported impossible to construct

There are a few places were we have to construct it, though, and a few
places that are more invasive to change. To do this, we create a
constructor with a long obvious name.
This commit is contained in:
mark 2022-01-22 18:49:12 -06:00
parent 461e807801
commit bb8d4307eb
104 changed files with 705 additions and 550 deletions

View file

@ -259,7 +259,7 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
self.tcx.sess.diagnostic().emit_diagnostic(&error);
}
} else {
assert!(self.tcx.sess.has_errors());
assert!(self.tcx.sess.has_errors().is_some());
}
}
@ -327,8 +327,8 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
match op.importance() {
ops::DiagnosticImportance::Primary => {
self.error_emitted = Some(ErrorGuaranteed);
err.emit();
let reported = err.emit();
self.error_emitted = Some(reported);
}
ops::DiagnosticImportance::Secondary => err.buffer(&mut self.secondary_errors),