Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix type inference with IndexMut returning references #16085

Merged
merged 1 commit into from
Jan 3, 2024

Conversation

Austaras
Copy link
Contributor

Closes #15842.

This issue arises because K is ambiguous if only inferred from Index trait, but is unique if inferred from IndexMut, but r-a doesn't use this info.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 11, 2023
&[index_ty.clone().cast(Interner)],
);

if *is_assignee_expr {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does no harm to obligate every indexing for IndexMut because r-a currently only save obligation that can be solved and it won't need an extra field in HIR, but I believe it's better to be more precise.

@Veykril
Copy link
Member

Veykril commented Jan 3, 2024

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented Jan 3, 2024

📌 Commit 1b7968a has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jan 3, 2024

⌛ Testing commit 1b7968a with merge 3fe6ff7...

@bors
Copy link
Contributor

bors commented Jan 3, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 3fe6ff7 to master...

@bors bors merged commit 3fe6ff7 into rust-lang:master Jan 3, 2024
10 checks passed
@lnicola lnicola changed the title fix: try obligation of IndexMut when infer fix: fix type inference with IndexMut returning references Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Type inference unknown when using references
4 participants