From bb8d4307eb723850e98bcb52d71d860a4aba220a Mon Sep 17 00:00:00 2001 From: mark Date: Sat, 22 Jan 2022 18:49:12 -0600 Subject: 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. --- compiler/rustc_const_eval/src/transform/check_consts/check.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'compiler/rustc_const_eval/src/transform') diff --git a/compiler/rustc_const_eval/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs index 7dc279cc840..eb01e261c1a 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs @@ -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), -- cgit 1.4.1-3-g733a5