diff options
Diffstat (limited to 'compiler/rustc_middle/src/ty/fold.rs')
| -rw-r--r-- | compiler/rustc_middle/src/ty/fold.rs | 8 | 
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/fold.rs b/compiler/rustc_middle/src/ty/fold.rs index 4922d07ae1c..780d380da36 100644 --- a/compiler/rustc_middle/src/ty/fold.rs +++ b/compiler/rustc_middle/src/ty/fold.rs @@ -51,6 +51,7 @@ //! ``` use crate::mir; use crate::ty::{self, flags::FlagComputation, Binder, Ty, TyCtxt, TypeFlags}; +use rustc_errors::ErrorGuaranteed; use rustc_hir::def_id::DefId; use rustc_data_structures::fx::FxHashSet; @@ -151,6 +152,13 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone { fn references_error(&self) -> bool { self.has_type_flags(TypeFlags::HAS_ERROR) } + fn error_reported(&self) -> Option<ErrorGuaranteed> { + if self.references_error() { + Some(ErrorGuaranteed::unchecked_claim_error_was_emitted()) + } else { + None + } + } fn has_param_types_or_consts(&self) -> bool { self.has_type_flags(TypeFlags::HAS_TY_PARAM | TypeFlags::HAS_CT_PARAM) }  | 
