rust-analyzer/crates/ide
Francis McKenzie e77752eaf0 Fix for #17497 - Invalid RA diagnostic error: expected 2 arguments, found 1
The issue occurs because in some configurations of traits where one of them has Deref as a supertrait, RA's type inference algorithm fails to resolve the Deref::Target type, and instead uses a TyKind::BoundVar (i.e. an unknown type). This "autoderefed" type then incorrectly acts as if it implements all traits in scope.

The fix is to re-apply the same sanity-check that is done in iterate_method_candidates_with_autoref(), that is: don't try to resolve methods on unknown types. This same sanity-check is now done on each autoderefed type for which trait methods are about to be checked. If the autoderefed type is unknown, then the iterating of the trait methods for that type is skipped.

Includes a unit test that only passes after applying the fixes in this commit.

Includes a change to the assertion count in test syntax_highlighting::tests::benchmark_syntax_highlighting_parser as suggested by Lukas Wirth during review.

Includes a change to the sanity-check code as suggested by Florian Diebold during review.
2024-07-28 00:32:37 +08:00
..
src Fix for #17497 - Invalid RA diagnostic error: expected 2 arguments, found 1 2024-07-28 00:32:37 +08:00
Cargo.toml Add f16 and f128 support 2024-07-10 10:43:14 +01:00