rust/compiler/rustc_errors/src
Nicholas Nethercote 56c3265c7b Replace warn_count.
There are four functions that adjust error and warning counts:
- `stash_diagnostic` (increment)
- `steal_diagnostic` (decrement)
- `emit_stashed_diagnostics) (decrement)
- `emit_diagnostic` (increment)

The first three all behave similarly, and only update `warn_count` for
forced warnings. But the last one updates `warn_count` for both forced
and non-forced warnings.

Seems like a bug. How should it be fixed? Well, `warn_count` is only
used in one place: `DiagCtxtInner::drop`, where it's part of the
condition relating to the printing of `good_path_delayed_bugs`. The
intention of that condition seems to be "have any errors been printed?"
so this commit replaces `warn_count` with `has_printed`, which is set
when printing occurs. This is simpler than all the ahead-of-time
incrementing and decrementing.
2024-01-11 07:56:20 +11:00
..
json Rename many DiagCtxt and EarlyDiagCtxt locals. 2023-12-18 16:06:22 +11:00
markdown remove redundant imports 2023-12-10 10:56:22 +08:00
annotate_snippet_emitter_writer.rs Change how force-warn lint diagnostics are recorded. 2024-01-11 07:56:17 +11:00
diagnostic_builder.rs Add missing DiagnosticBuilder::eager_diagnostic method. 2024-01-10 07:40:44 +11:00
diagnostic_impls.rs Rename consuming chaining methods on DiagnosticBuilder. 2024-01-10 07:40:00 +11:00
diagnostic.rs Change how force-warn lint diagnostics are recorded. 2024-01-11 07:56:17 +11:00
emitter.rs Add some comments to Emitter. 2024-01-05 10:49:35 +11:00
error.rs Make translate_message return result and add tests 2023-01-08 23:35:43 +01:00
json.rs Change how force-warn lint diagnostics are recorded. 2024-01-11 07:56:17 +11:00
lib.rs Replace warn_count. 2024-01-11 07:56:20 +11:00
lock.rs bump windows crate 0.46 -> 0.48 in workspace 2023-05-09 18:20:13 +03:00
registry.rs refactor: statically guarantee that current error codes are documented 2023-02-26 20:12:36 +13:00
snippet.rs Create AnnotationColumn struct to fix hard tab column numbers in errors 2023-03-28 09:18:55 -04:00
styled_buffer.rs Replace some _ == _ || _ == _s with matches!(_, _ | _)s 2023-01-30 12:26:26 +00:00
tests.rs Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
translation.rs Restore behavior when primary bundle is missing 2023-02-23 01:14:10 +01:00