We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1f21b96 commit 465ac26Copy full SHA for 465ac26
compiler/rustc_middle/src/ty/visit.rs
@@ -97,7 +97,11 @@ pub trait TypeVisitable<'tcx>: fmt::Debug + Clone {
97
}
98
fn error_reported(&self) -> Result<(), ErrorGuaranteed> {
99
if self.references_error() {
100
- Err(ErrorGuaranteed::unchecked_claim_error_was_emitted())
+ if let Some(reported) = ty::tls::with(|tcx| tcx.sess.has_errors()) {
101
+ Err(reported)
102
+ } else {
103
+ bug!("expect tcx.sess.has_errors return true");
104
+ }
105
} else {
106
Ok(())
107
0 commit comments