Skip to content

Commit

Permalink
deprecate unchecked_claim_error_was_emitted in error_reported
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Nov 8, 2022
1 parent 1f21b96 commit 465ac26
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion compiler/rustc_middle/src/ty/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ pub trait TypeVisitable<'tcx>: fmt::Debug + Clone {
}
fn error_reported(&self) -> Result<(), ErrorGuaranteed> {
if self.references_error() {
Err(ErrorGuaranteed::unchecked_claim_error_was_emitted())
if let Some(reported) = ty::tls::with(|tcx| tcx.sess.has_errors()) {
Err(reported)
} else {
bug!("expect tcx.sess.has_errors return true");
}
} else {
Ok(())
}
Expand Down

0 comments on commit 465ac26

Please sign in to comment.