rust/tests/ui/mir
Nicholas Nethercote f1ac54123f Don't consider delayed bugs for -Ztreat-err-as-bug.
`-Ztreat-err-as-bug` treats normal errors and delayed bugs equally,
which can lead to some really surprising results.

This commit changes `-Ztreat-err-as-bug` so it ignores delayed bugs,
unless they get promoted to proper bugs and are printed.

This feels to me much simpler and more logical. And it simplifies the
implementation:
- The `-Ztreat-err-as-bug` check is removed from in
  `DiagCtxt::{delayed_bug,span_delayed_bug}`.
- `treat_err_as_bug` doesn't need to count delayed bugs.
- The `-Ztreat-err-as-bug` panic message is simpler, because it doesn't
  have to mention delayed bugs.

Output of delayed bugs is now more consistent. They're always printed
the same way. Previously when they triggered `-Ztreat-err-as-bug` they
would be printed slightly differently, via `span_bug` in
`span_delayed_bug` or `delayed_bug`.

A minor behaviour change: the "no errors encountered even though
`span_delayed_bug` issued" printed before delayed bugs is now a note
rather than a bug. This is done so it doesn't get counted as an error
that might trigger `-Ztreat-err-as-bug`, which would be silly.
This means that if you use `-Ztreat-err-as-bug=1` and there are no
normal errors but there are delayed bugs, the first delayed bug will be
shown (and the panic will happen after it's printed).

Also, I have added a second note saying "those delayed bugs will now be
shown as internal compiler errors". I think this makes it clearer what
is happening, because the whole concept of delayed bugs is non-obvious.

There are some test changes.
- equality-in-canonical-query.rs: Minor output changes, and the error
  count reduces by one because the "no errors encountered even though
  `span_delayed_bug` issued" message is no longer counted as an error.
- rpit_tait_equality_in_canonical_query.rs: Ditto.
- storage-live.rs: The query stack disappears because these delayed bugs
  are now printed at the end, rather than when they are created.
- storage-return.rs, span_delayed_bug.rs: now need
  `-Zeagerly-emit-delayed-bugs` because they need the delayed bugs
  emitted immediately to preserve behaviour.
2024-01-13 09:59:56 +11:00
..
alignment
auxiliary
lint Don't consider delayed bugs for -Ztreat-err-as-bug. 2024-01-13 09:59:56 +11:00
mir-inlining
validate custom mir: make it clear what the return block is 2023-12-26 20:15:26 +01:00
build-async-error-body-correctly.rs Build pre-coroutine-transform coroutine body 2023-11-07 21:14:43 +00:00
build-async-error-body-correctly.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
checks_without_panic_impl.rs
debug-ref-undef.rs
drop-elaboration-after-borrowck-error.rs
drop-elaboration-after-borrowck-error.stderr
field-projection-invariant.rs
field-projection-mutating-context2.rs
field-projection-mutating-context2.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
field-projection-mutating-context.rs
field-projection-mutating-context.stderr recurse into refs when comparing tys for diagnostics 2023-12-07 23:00:46 -05:00
field-ty-ascription-enums.rs
field-ty-ascription.rs
important-higher-ranked-regions.rs
issue66339.rs
issue-29227.rs
issue-46845.rs
issue-60390.rs
issue-66851.rs
issue-66930.rs
issue-67639-normalization-ice.rs
issue-67710-inline-projection.rs
issue-67947.rs
issue-67947.stderr
issue-68841.rs
issue-71793-inline-args-storage.rs
issue-73914.rs
issue-74739.rs
issue-75053.rs
issue-75053.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-75419-validation-impl-trait.rs
issue-76248.rs
issue-76375.rs
issue-76740-copy-propagation.rs
issue-76803-branches-not-same.rs
issue-77002.rs
issue-77359-simplify-arm-identity.rs
issue-77911.rs
issue-78496.rs
issue-80949.rs
issue-83499-input-output-iteration-ice.rs
issue-83499-input-output-iteration-ice.stderr
issue-89485.rs
issue-91745.rs
issue-92893.rs
issue-92893.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-99852.rs
issue-99866.rs
issue-101844.rs
issue-102389.rs
issue-102389.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-105809.rs
issue-106062.rs
issue-106062.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-107678-projection-with-lifetime.rs
issue-107691.rs
issue-109004-drop-large-array.rs
issue-109743.rs
issue-112269.rs
issue-112269.stderr
mir_adt_construction.rs
mir_ascription_coercion.rs
mir_assign_eval_order.rs
mir_augmented_assignments.rs
mir_autoderef.rs
mir_build_match_comparisons.rs
mir_call_with_associated_type.rs
mir_calls_to_shims.rs
mir_cast_fn_ret.rs
mir_codegen_array_2.rs
mir_codegen_array.rs
mir_codegen_call_converging.rs
mir_codegen_calls_converging_drops_2.rs
mir_codegen_calls_converging_drops.rs
mir_codegen_calls_diverging_drops.rs
mir_codegen_calls_diverging.rs
mir_codegen_calls.rs
mir_codegen_critical_edge.rs
mir_codegen_spike1.rs
mir_codegen_ssa.rs
mir_codegen_switch.rs Adjust compiler tests for unused_tuple_struct_fields -> dead_code 2024-01-02 15:34:37 -05:00
mir_codegen_switchint.rs
mir_coercion_casts.rs
mir_coercions.rs
mir_const_prop_identity.rs
mir_const_prop_tuple_field_reorder.rs
mir_constval_adts.rs
mir_detects_invalid_ops.rs
mir_detects_invalid_ops.stderr
mir_drop_order.rs
mir_drop_panics.rs
mir_dynamic_drops_1.rs
mir_dynamic_drops_2.rs
mir_dynamic_drops_3.rs
mir_early_return_scope.rs
mir_fat_ptr_drop.rs
mir_fat_ptr.rs Adjust compiler tests for unused_tuple_struct_fields -> dead_code 2024-01-02 15:34:37 -05:00
mir_heavy_promoted.rs
mir_indexing_oob_1.rs
mir_indexing_oob_2.rs
mir_indexing_oob_3.rs
mir_let_chains_drop_order.rs
mir_match_arm_guard.rs
mir_match_test.rs
mir_misc_casts.rs
mir_overflow_off.rs
mir_raw_fat_ptr.rs Adjust compiler tests for unused_tuple_struct_fields -> dead_code 2024-01-02 15:34:37 -05:00
mir_refs_correct.rs Adjust compiler tests for unused_tuple_struct_fields -> dead_code 2024-01-02 15:34:37 -05:00
mir_small_agg_arg.rs
mir_static_subtype.rs
mir_struct_with_assoc_ty.rs
mir_temp_promotions.rs
mir_void_return_2.rs
mir_void_return.rs
mir-typeck-normalize-fn-sig.rs
remove-zsts-query-cycle.rs
simplify-branch-same.rs
ssa_call_ret.rs custom mir: make it clear what the return block is 2023-12-26 20:15:26 +01:00
ssa-analysis-regression-50041.rs
thir-constparam-temp.rs
thir-constparam-temp.stderr
unsize-trait.rs