Skip to content

Commit

Permalink
Remove TypeErrCtxt::drop.
Browse files Browse the repository at this point in the history
The check within changed from `delay_span_bug` to `delay_good_path_bug`
in rust-lang#110476, and removing the check altogether was considered. It's a
very weak sanity check and gets in the way of removing good path delayed
bugs altogether, so this PR just removes it.
  • Loading branch information
nnethercote authored and RustyYato committed Jun 2, 2024
1 parent eb029d2 commit 32c77ec
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions compiler/rustc_infer/src/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,20 +132,6 @@ pub struct TypeErrCtxt<'a, 'tcx> {
Box<dyn Fn(Ty<'tcx>) -> Vec<(Ty<'tcx>, Vec<PredicateObligation<'tcx>>)> + 'a>,
}

impl Drop for TypeErrCtxt<'_, '_> {
fn drop(&mut self) {
if self.dcx().has_errors().is_some() {
// Ok, emitted an error.
} else {
// Didn't emit an error; maybe it was created but not yet emitted.
self.infcx
.tcx
.sess
.good_path_delayed_bug("used a `TypeErrCtxt` without raising an error or lint");
}
}
}

impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
pub fn dcx(&self) -> &'tcx DiagCtxt {
self.infcx.tcx.dcx()
Expand Down

0 comments on commit 32c77ec

Please sign in to comment.