rust/compiler/rustc_errors/src
bors 7b21c18fe4 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.
2024-07-01 06:35:58 +00:00
..
json Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
markdown Add blank lines after module-level //! comments. 2024-06-20 09:23:20 +10:00
annotate_snippet_emitter_writer.rs Rename DiagnosticMessage as DiagMessage. 2024-03-05 12:14:49 +11:00
codes.rs Stop using String for error codes. 2024-01-29 07:41:41 +11:00
diagnostic_impls.rs Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
diagnostic.rs Automatically taint InferCtxt when errors are emitted 2024-06-26 16:01:45 +00:00
emitter.rs Special case when a code line only has multiline span starts 2024-06-23 22:00:52 +00:00
error.rs Minor visibility and formatting improvements. 2024-02-29 16:30:09 +11:00
json.rs Clarify comment on changing to warn future breakage items 2024-06-26 17:00:46 +02:00
lib.rs Document new field and function 2024-06-27 09:45:26 +00:00
lock.rs windows bump to 0.52 2024-02-18 16:02:16 +03:00
registry.rs Stop using String for error codes. 2024-01-29 07:41:41 +11:00
snippet.rs Remove extern crate rustc_macros from numerous crates. 2024-04-29 10:21:54 +10:00
styled_buffer.rs Replace some _ == _ || _ == _s with matches!(_, _ | _)s 2023-01-30 12:26:26 +00:00
tests.rs Rename DiagnosticMessage as DiagMessage. 2024-03-05 12:14:49 +11:00
translation.rs Remove extern crate tracing from numerous crates. 2024-04-30 16:47:49 +10:00