rust/tests
Michael Goulet 0bb00e2085
Rollup merge of #137289 - compiler-errors:coerce-unsized-errors, r=oli-obk
Consolidate and improve error messaging for `CoerceUnsized` and `DispatchFromDyn`

Firstly, this PR consolidates and reworks the error diagnostics for `CoercePointee` and `DispatchFromDyn`. There was a ton of duplication for no reason -- this reworks both the errors and also the error codes, since they can be shared between both traits since they report the same thing.

Secondly, when encountering a struct with multiple fields that must be coerced, point out the field spans, rather than mentioning the fields by name. This makes the error message clearer, but also means that we don't mention the `__S` dummy parameter for `derive(CoercePointee)`.

Thirdly, emit a custom error message when we encounter a trait error that comes from the recursive field `CoerceUnsized`/`DispatchFromDyn` trait check. **Note:** This is the only one I'm not too satisfied with -- I think it could use some more refinement, but ideally it explains that the field must be an unsize-able pointer... Feedback welcome.

Finally, don't emit `DispatchFromDyn` validity errors if we detect `CoerceUnsized` validity errors from an impl of the same ADT.

This is best reviewed per commit.

r? `@oli-obk` perhaps?

cc `@dingxiangfei2009` -- sorry for making my own attempt at this PR, but I wanted to see if I could implement a fix for #136796 in a less complicated way, since communicating over github review comments can be a bit slow. I'll leave comments inline to explain my thinking about the diagnostics changes.
2025-02-24 19:21:45 -05:00
..
assembly Rollup merge of #137324 - flba-eb:rename_qnx_target_name_i586, r=workingjubilee 2025-02-20 14:58:21 -08:00
auxiliary use add-core-stubs / minicore for a few more tests 2025-02-16 18:37:50 +01:00
codegen Rollup merge of #137491 - jieyouxu:mango-less-likely, r=saethlin 2025-02-24 02:11:35 -05:00
codegen-units Remove -Zinline-in-all-cgus and clean up CGU partitioning tests 2025-01-27 23:48:47 -05:00
coverage coverage: Add some more cases to tests/coverage/holes.rs 2025-02-19 13:56:20 +11:00
coverage-run-rustdoc
crashes Rollup merge of #137458 - compiler-errors:render-fn, r=fmease 2025-02-23 02:44:20 -05:00
debuginfo Rollup merge of #135354 - Walnut356:msvc_lldb, r=wesleywiser 2025-02-23 02:44:16 -05:00
incremental tests: error strings for ABI stability now match 2025-02-09 20:45:47 -08:00
mir-opt Auto merge of #136771 - scottmcm:poke-slice-iter-next, r=joboet 2025-02-20 18:20:40 +00:00
pretty Update tests to use new proc-macro header 2024-11-27 07:18:25 -08:00
run-make avr-rjmp-offset: Explain .target_cpu() 2025-02-20 15:05:06 +01:00
rustdoc fix rustdoc test directives that were accidentally ignored 2025-02-16 19:34:50 +00:00
rustdoc-gui Rollup merge of #136991 - GuillaumeGomez:code-wrapping, r=notriddle 2025-02-24 02:11:32 -05:00
rustdoc-js Rollup merge of #134277 - notriddle:notriddle/inline-into, r=GuillaumeGomez 2024-12-16 20:00:20 +01:00
rustdoc-js-std Remove the common prelude module 2025-02-11 13:04:27 -08:00
rustdoc-json Add missing lang items in no_core tests in rustdoc 2025-02-04 01:05:31 +00:00
rustdoc-ui Rollup merge of #137120 - ChrisDenton:its-all-relative, r=GuillaumeGomez 2025-02-17 06:38:15 +01:00
ui Rollup merge of #137289 - compiler-errors:coerce-unsized-errors, r=oli-obk 2025-02-24 19:21:45 -05:00
ui-fulldeps Auto merge of #137164 - matthiaskrgr:rollup-dj5826k, r=matthiaskrgr 2025-02-17 11:18:33 +00:00
COMPILER_TESTS.md