about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-07-01 06:35:58 +0000
committerbors <bors@rust-lang.org>2024-07-01 06:35:58 +0000
commit7b21c18fe4de32a7d2faa468e6ef69abff013f85 (patch)
tree038a7371e130281952f9c36b88d5e512c231fe54 /compiler/rustc_const_eval/src
parentf92a6c41e644d6222be77b20396daec5e77661f3 (diff)
parentbd111f5c4bbf3726ef0c9daf78c16c453bf5cb3d (diff)
downloadrust-7b21c18fe4de32a7d2faa468e6ef69abff013f85.tar.gz
rust-7b21c18fe4de32a7d2faa468e6ef69abff013f85.zip
Auto merge of #126996 - oli-obk:do_not_count_errors, r=nnethercote
Automatically taint InferCtxt when errors are emitted

r? `@nnethercote`

Basically `InferCtxt::dcx` now returns a `DiagCtxt` that refers back to the `Cell<Option<ErrorGuaranteed>>` of the `InferCtxt` and thus when invoking `Diag::emit`, and the diagnostic is an error, we taint the `InferCtxt` directly.

That change on its own has no effect at all, because `InferCtxt` already tracks whether errors have been emitted by recording the global error count when it gets opened, and checking at the end whether the count changed. So I removed that error count check, which had a bit of fallout that I immediately fixed by invoking `InferCtxt::dcx` instead of `TyCtxt::dcx` in a bunch of places.

The remaining new errors are because an error was reported in another query, and never bubbled up. I think they are minor enough for this to be ok, and sometimes it actually improves diagnostics, by not silencing useful diagnostics anymore.

fixes #126485 (cc `@olafes)`

There are more improvements we can do (like tainting in hir ty lowering), but I would rather do that in follow up PRs, because it requires some refactorings.
Diffstat (limited to 'compiler/rustc_const_eval/src')
0 files changed, 0 insertions, 0 deletions