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 MethodCalls for covariant impl blocks #810

Merged
merged 5 commits into from Nov 18, 2021
Merged

Fix MethodCalls for covariant impl blocks #810

merged 5 commits into from Nov 18, 2021

Conversation

philberty
Copy link
Member

@philberty philberty commented Nov 17, 2021

I think we need to research more into how we probe for potential candidates
for method calls. This fixes a few bugs going on in #808 one where the
canonical path was empty and one where we fail to probe directly on the
receiver of reference types to impl blocks but we must be able to also support
that autoderef means that a receiver's root type might actually be the type we
care about for example a reference to a generic type-parameter and we probe
its bounds for candidates for example. Lets consult the rustc code and references on this.

Fixes #808

This fixes the ice for TypeNoBounds canonical paths for reference types
which was not implemented resulting in empty paths for the canonical
path of impl_blocks for example.

A Fixme has been added to point out that we should update this interface
to only take AST::TypeNoBounds.

Fixes #808
When we must infer the substitutions on method calls we must make sure to
unify the self arguments from the receiver, taking into account the
autoderef mechanism. This enforces the type checks and fixes up any
inference variables along the way.

Addresses #808
@philberty philberty added the bug label Nov 17, 2021
@philberty philberty self-assigned this Nov 17, 2021
@philberty philberty added this to In progress in Control Flow 2 via automation Nov 17, 2021
@philberty philberty moved this from In progress to Review in progress in Control Flow 2 Nov 17, 2021
Impl blocks Self type is a TypeNoBouns which means it can be for types
such as: impl<T> &T {}.

I think we might need to change the probe algorithm for method calls to be
fully based on the autoderef rather than trying to filter based on the Self
type. More investigation is needed for the probe phase here.

Fixes #808
@philberty
Copy link
Member Author

bors r+

@philberty philberty moved this from Review in progress to Reviewer approved in Control Flow 2 Nov 18, 2021
@bors
Copy link
Contributor

bors bot commented Nov 18, 2021

Build succeeded:

@bors bors bot merged commit 0995184 into master Nov 18, 2021
Control Flow 2 automation moved this from Reviewer approved to Done Nov 18, 2021
@philberty philberty deleted the phil/bug-fix branch November 22, 2021 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

ICE with multiple generic trait-impl blocks for the same trait
1 participant