rust/tests
Nicholas Nethercote 72b172bdf6 Overhaul the handling of errors at the top-level.
Currently `emit_stashed_diagnostic` is called from four(!) different
places: `print_error_count`, `DiagCtxtInner::drop`, `abort_if_errors`,
and `compile_status`.

And `flush_delayed` is called from two different places:
`DiagCtxtInner::drop` and `Queries`.

This is pretty gross! Each one should really be called from a single
place, but there's a bunch of entanglements. This commit cleans up this
mess.

Specifically, it:
- Removes all the existing calls to `emit_stashed_diagnostic`, and adds
  a single new call in `finish_diagnostics`.
- Removes the early `flush_delayed` call in `codegen_and_build_linker`,
  replacing it with a simple early return if delayed bugs are present.
- Changes `DiagCtxtInner::drop` and `DiagCtxtInner::flush_delayed` so
  they both assert that the stashed diagnostics are empty (i.e.
  processed beforehand).
- Changes `interface::run_compiler` so that any errors emitted during
  `finish_diagnostics` (i.e. late-emitted stashed diagnostics) are
  counted and cannot be overlooked. This requires adding
  `ErrorGuaranteed` return values to several functions.
- Removes the `stashed_err_count` call in `analysis`. This is possible
  now that we don't have to worry about calling `flush_delayed` early
  from `codegen_and_build_linker` when stashed diagnostics are pending.
- Changes the `span_bug` case in `handle_tuple_field_pattern_match` to a
  `delayed_span_bug`, because it now can be reached due to the removal
  of the `stashed_err_count` call in `analysis`.
- Slightly changes the expected output of three tests. If no errors are
  emitted but there are delayed bugs, the error count is no longer
  printed. This is because delayed bugs are now always printed after the
  error count is printed (or not printed, if the error count is zero).

There is a lot going on in this commit. It's hard to break into smaller
pieces because the existing code is very tangled. It took me a long time
and a lot of effort to understand how the different pieces interact, and
I think the new code is a lot simpler and easier to understand.
2024-02-22 08:03:47 +11:00
..
assembly Bless/fix tests 2024-02-08 19:56:30 -05:00
auxiliary
codegen Auto merge of #120718 - saethlin:reasonable-fast-math, r=nnethercote 2024-02-21 09:43:33 +00:00
codegen-units Update tests 2024-02-07 10:42:01 +08:00
coverage Update coverage-run tests 2024-02-18 20:51:45 +03:00
coverage-run-rustdoc coverage: Don't instrument #[automatically_derived] functions 2024-01-22 12:18:57 +11:00
debuginfo update debuginfo test 2024-02-16 12:10:50 +01:00
incremental Auto merge of #120919 - oli-obk:impl_polarity, r=compiler-errors 2024-02-13 02:48:49 +00:00
mir-opt Auto merge of #121172 - Nadrieril:simplify-empty-selection, r=matthewjasper 2024-02-21 03:11:24 +00:00
pretty Auto merge of #120227 - nnethercote:further-improve-space_between, r=petrochenkov 2024-01-31 02:01:43 +00:00
run-make Update data layouts in custom target tests for LLVM 18 2024-01-31 15:15:59 +01:00
run-make-fulldeps Make CodegenBackend::join_codegen infallible. 2024-02-17 10:51:35 +11:00
run-pass-valgrind
rustdoc Rollup merge of #121218 - ShoyuVanilla:fix-issue-76736, r=notriddle 2024-02-18 05:10:18 +01:00
rustdoc-gui Add regression test for #120471 to ensure that long crate name are handled as expected on mobile 2024-01-31 16:40:23 +01:00
rustdoc-js
rustdoc-js-std
rustdoc-json
rustdoc-ui Clean inlined type alias with correct param-env 2024-02-12 04:51:49 +00:00
ui Overhaul the handling of errors at the top-level. 2024-02-22 08:03:47 +11:00
ui-fulldeps Merge diagnostic_builder.rs into diagnostic.rs. 2024-02-21 11:03:31 +11:00
COMPILER_TESTS.md