11//! The `Visitor` responsible for actually checking a `mir::Body` for invalid operations.
22
3- use rustc_errors:: { struct_span_err, Applicability , Diagnostic } ;
3+ use rustc_errors:: { struct_span_err, Applicability , Diagnostic , ErrorReported } ;
44use rustc_hir:: def_id:: DefId ;
55use rustc_hir:: { self as hir, HirId , LangItem } ;
66use rustc_infer:: infer:: TyCtxtInferExt ;
@@ -126,7 +126,7 @@ impl Qualifs<'mir, 'tcx> {
126126 fn in_return_place (
127127 & mut self ,
128128 ccx : & ' mir ConstCx < ' mir , ' tcx > ,
129- error_occured : bool ,
129+ error_occured : Option < ErrorReported > ,
130130 ) -> ConstQualifs {
131131 // Find the `Return` terminator if one exists.
132132 //
@@ -186,7 +186,7 @@ pub struct Validator<'mir, 'tcx> {
186186 /// The span of the current statement.
187187 span : Span ,
188188
189- error_emitted : bool ,
189+ error_emitted : Option < ErrorReported > ,
190190 secondary_errors : Vec < Diagnostic > ,
191191}
192192
@@ -204,7 +204,7 @@ impl Validator<'mir, 'tcx> {
204204 span : ccx. body . span ,
205205 ccx,
206206 qualifs : Default :: default ( ) ,
207- error_emitted : false ,
207+ error_emitted : None ,
208208 secondary_errors : Vec :: new ( ) ,
209209 }
210210 }
@@ -271,7 +271,7 @@ impl Validator<'mir, 'tcx> {
271271 // If we got through const-checking without emitting any "primary" errors, emit any
272272 // "secondary" errors if they occurred.
273273 let secondary_errors = mem:: take ( & mut self . secondary_errors ) ;
274- if ! self . error_emitted {
274+ if self . error_emitted . is_none ( ) {
275275 for error in secondary_errors {
276276 self . tcx . sess . diagnostic ( ) . emit_diagnostic ( & error) ;
277277 }
@@ -323,7 +323,7 @@ impl Validator<'mir, 'tcx> {
323323
324324 match op. importance ( ) {
325325 ops:: DiagnosticImportance :: Primary => {
326- self . error_emitted = true ;
326+ self . error_emitted = Some ( ErrorReported ) ;
327327 err. emit ( ) ;
328328 }
329329
0 commit comments