rust/tests
Matthias Krüger 634e5c9ba2
Rollup merge of #116158 - compiler-errors:unconstrained-type-var-sugg, r=wesleywiser
Don't suggest nonsense suggestions for unconstrained type vars in `note_source_of_type_mismatch_constraint`

The way we do type inference for suggestions in `note_source_of_type_mismatch_constraint` is a bit strange. We compute the "ideal" method signature, which takes the receiver that we *want* and uses it to compute the types of the arguments that would have given us that receiver via type inference, and use *that* to suggest how to change an argument to make sure our receiver type is inferred correctly.

The problem is that sometimes we have totally unconstrained arguments (well, they're constrained by things outside of the type checker per se, like associated types), and therefore type suggestions are happy to coerce anything to that unconstrained argument. This leads to bogus suggestions, like #116155. This is partly due to above, and partly due to the fact that `emit_type_mismatch_suggestions` doesn't double check that its suggestions are actually compatible with the program other than trying to satisfy the type mismatch.

This adds a hack to make sure that at least the types are fully constrained, but I guess I could also rip out this logic altogether. There would be some sad diagnostics regressions though, such as `tests/ui/type/type-check/point-at-inference-4.rs`.

Fixes #116155
2023-10-03 08:58:48 +02:00
..
assembly Limit to LLVM 17.0.2 to work around WinEH codegen bug 2023-10-02 11:06:38 +02:00
auxiliary
codegen Limit to LLVM 17.0.2 to work around WinEH codegen bug 2023-10-02 11:06:38 +02:00
codegen-units
coverage-map coverage: Regression test for functions with unreachable bodies 2023-10-01 14:44:27 +11:00
debuginfo
incremental Rollup merge of #116263 - ferrocene:pa-more-bare-metal-fixes, r=oli-obk 2023-09-29 22:27:52 +02:00
mir-opt Auto merge of #115759 - oli-obk:open_drop_from_non-ADT, r=lcnr 2023-09-29 11:59:51 +00:00
pretty
run-coverage coverage: Regression test for functions with unreachable bodies 2023-10-01 14:44:27 +11:00
run-coverage-rustdoc
run-make Auto merge of #113301 - Be-ing:stabilize_bundle_whole-archive, r=petrochenkov 2023-09-29 15:51:48 +00:00
run-make-fulldeps
run-pass-valgrind
rustdoc
rustdoc-gui
rustdoc-js
rustdoc-js-std
rustdoc-json
rustdoc-ui
ui Rollup merge of #116158 - compiler-errors:unconstrained-type-var-sugg, r=wesleywiser 2023-10-03 08:58:48 +02:00
ui-fulldeps Remove rustc_lint_defs::lint_array 2023-09-28 23:01:25 +02:00
COMPILER_TESTS.md