-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #17505 - ShoyuVanilla:issue-17199, r=Veykril
Use proper `ImplTraits` in `insert_inference_vars_for_impl_trait` Fixes #17199 and fixes #17403 In the previous implementation, I passed `rpits` as a function parameter and used `idx` of `ImplTraitId` for indexing `ImplTrait`. https://github.com/rust-lang/rust-analyzer/blob/4e836c622a7bdab41be8e82733dd9fe40af128b2/crates/hir-ty/src/infer.rs#L881-L887 But that `idx` is rather a "local" one, so in the cases like mentioned issues, the async function that can be expanded roughly as ```rust type TypeAlias = impl Something; fn expanded_async() -> impl Future<Output = TypeAlias> { ... } ``` there are two bundles of `ImplTraits`; one for the `impl Future` and the other one for `TypeAlias`. So using `idx` with `rpits` returns `ImplTrait` for `impl Future` even if we are asking for `TypeAlias` and this caused a stack overflow. This PR is a fix for that implementation miss 😅
- Loading branch information
Showing
2 changed files
with
38 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters