rust/compiler/rustc_borrowck/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
..
constraints Move RegionTracker to region_infer 2024-06-12 15:48:34 +02:00
diagnostics Auto merge of #126996 - oli-obk:do_not_count_errors, r=nnethercote 2024-07-01 06:35:58 +00:00
polonius Remove confusing use_polonius flag and do less cloning 2024-06-05 10:57:27 +02:00
region_infer Automatically taint InferCtxt when errors are emitted 2024-06-26 16:01:45 +00:00
type_check Split lifetimes on mir borrowck dataflow 2024-06-26 16:01:44 +00:00
util Move some utils out of rustc_const_eval 2023-04-16 12:05:54 +02:00
borrow_set.rs Remove confusing use_polonius flag and do less cloning 2024-06-05 10:57:27 +02:00
borrowck_errors.rs Rename 'cx to 'infcx 2024-06-27 09:07:57 +00:00
consumers.rs BorrowckInferCtxt: infcx by value 2024-05-06 15:20:13 +00:00
dataflow.rs Split lifetimes on mir borrowck dataflow 2024-06-26 16:01:44 +00:00
def_use.rs Remove extern crate rustc_middle from numerous crates. 2024-04-29 14:50:45 +10:00
facts.rs Uplift RegionVid 2024-05-20 13:57:58 -04:00
lib.rs Rename 'cx to 'infcx 2024-06-27 09:07:57 +00:00
location.rs Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
member_constraints.rs Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
nll.rs Restrict diagnostic context lifetime of mir borrowck to InferCtxt instead of TyCtxt 2024-06-26 16:01:44 +00:00
path_utils.rs remove a bunch of dead parameters in fn 2024-02-12 09:51:35 +08:00
place_ext.rs Move trait into attr so it's greppable 2024-02-16 15:07:37 +00:00
places_conflict.rs Remove extern crate rustc_middle from numerous crates. 2024-04-29 14:50:45 +10:00
prefixes.rs Separate the mir body lifetime from the other lifetimes 2024-06-24 14:28:14 +00:00
renumber.rs MIR visitor: constant -> const_operand 2024-06-13 15:37:13 +02:00
session_diagnostics.rs Prevent opaque types being instantiated twice with different regions within the same function 2024-03-18 10:26:10 +00:00
universal_regions.rs Stop proving outlives constraints on regions we already reported errors on 2024-05-29 09:27:07 +00:00
used_muts.rs Rename 'cx to 'infcx 2024-06-27 09:07:57 +00:00