Skip to content

Fix ICE in reachability class and refactor associated types code #1190

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

Merged
merged 4 commits into from
Apr 28, 2022

Conversation

philberty
Copy link
Member

@philberty philberty commented Apr 28, 2022

There are several fixes going on to solve these issues which overlap with one
another so it seemed best to pack them within the same PR.

The main issue for #1128 was that we did not resolve a trait when it was unused
leading to us hitting the ICE in the privacy pass. Since the type check context was
empty for the trait since it was not resolved. To fix this we needed to refactor the
trait resolver to resolve the trait as part of iterating the crate. This resulted in some
regressions in the testsuite so this is why we need the the other commits. Which
required us to finally perform the refactor specified in #1105 to fix these.

Fixes #1105 #1128 #1132

We missed a case to ensure the substitutions are equal in the is_equal
interface. This becomes important when dealing with generic associated
types since the projections could end up overlapping and we need to
differentiate them by the substitutions and monomorphization.
From PR #1086 I introduced a new setup_associated_types2 interface which
is used to ensure we handle the complex associated types in libcore slices
but this interface was inconsistant as well as the get_projected_type.

This path refactors the code base to get rid of the old
setup_associated_types interface in favour of this new one. It also removes
the get_projected_type interface which was not going to work either.

Fixes #1105
During type-resolution we resolve/type-check traits in a query based way.
So when we reference a trait we look it up as required but this left a case
for the privacy pass where the type-context information on the trait when
the trait was not used meant there was no type-checking performed on the
trait.

This patch adds an interface to directly resolve the trait when as we
iterate the crate so we do it as required. There is already code in the
trait resolver to check if we have already type-resolved this trait.

Fixes #1128
Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

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

LGTM!

@philberty
Copy link
Member Author

bors r+

@bors bors bot merged commit 83e13db into master Apr 28, 2022
@bors
Copy link
Contributor

bors bot commented Apr 28, 2022

Build succeeded:

@philberty philberty deleted the phil/refactor-dev branch April 28, 2022 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment