Skip to content

Describe Type Alias Impl Trait (TAIT) Inference Algorithm #1297

New issue

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

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

Already on GitHub? # to your account

Merged
merged 6 commits into from
Jul 17, 2022

Conversation

nikomatsakis
Copy link
Contributor

This PR contains a draft writeup explaining rust-lang/rust#92007. Mostly at this point it has diagrams that I wrote. The idea was to help myself understand that PR.

cc @oli-obk, who is going to help me finish it up

This hackmd is linked to the branch so that we can edit it live.

@JohnTitor JohnTitor added the S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content label Feb 8, 2022
@pierwill
Copy link
Member

pierwill commented Feb 17, 2022

Regarding mdbook-mermaid, let's be sure to add this to the build instructions in the README.

@camelid
Copy link
Member

camelid commented Feb 17, 2022

Can you post a screenshot of what the mdbook-mermaid output looks like? cc @rust-lang/wg-rustc-dev-guide since this adds a new build tool

Copy link
Contributor Author

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

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

Here are the links

* Explain how it invokes `type_of`
* We look at the bounds, we are able to type check it as is

```mermaid
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The `type_of` query, when applied to an opaque type O, returns the hidden type. That hidden type is computed by combining the results from each constraining function within defining scope of O.

```mermaid
flowchart TD
Copy link
Contributor Author

Choose a reason for hiding this comment

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

### Within the ordinary type check of a single function

```mermaid
flowchart TD
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When queries encounter a `opaque_ty_obligation`, they do not try to process them, but instead just store the constraints into the infcx.

```mermaid
graph TD
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JohnTitor
Copy link
Member

Sorry for the delay, adding an additional seems fine, @nikomatsakis do you know the best person to review this PR? Maybe oli-obk?

@tshepang
Copy link
Member

@oli-obk is this alright

@oli-obk
Copy link
Contributor

oli-obk commented Jun 21, 2022

needs another sync with the hackmd, but yea, we should merge this once it passes CI again. We can iterate on the details later

@JohnTitor JohnTitor added S-waiting-on-author Status: this PR is waiting for additional action by the OP and removed S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content labels Jun 21, 2022
@JohnTitor
Copy link
Member

@nikomatsakis Could you fix the CI failure?

@tshepang
Copy link
Member

@JohnTitor CI says logs are deleted... are you able to see what the error is, and how does one restart CI?

@JohnTitor
Copy link
Member

CI says logs are deleted... are you able to see what the error is, and how does one restart CI?

I cannot either as it's too old, but CI stopped at "Check line lengths" so there should be a long line. Actually, L3 on src/opaque-types-type-alias-impl-trait-inference.md has more than 100 characters.

@tshepang
Copy link
Member

will merge this after CI succeeds, then sync with hackmd

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-author Status: this PR is waiting for additional action by the OP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants