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

add section for the new trait solver #1551

Merged
merged 8 commits into from
Jan 27, 2023
Merged

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Jan 10, 2023

still not done but a hopefully useful first step.

src/solve/canonicalization.md Outdated Show resolved Hide resolved

### 1. The trait solver has to be *sound*

This means that we must never return *success* for goals for which no `impl` exists. That would
Copy link
Member

Choose a reason for hiding this comment

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

This is not really accurate since the solver will return success for goals that can be proven by param env candidates that dont hold if you were to try and prove them as a caller 🤔 I get what is trying to be communicated here though and I don't know what a better way of wording it would be lol

Copy link
Contributor Author

Choose a reason for hiding this comment

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

param_env candidates mean that the caller has to provide an impl so it feels fairly accurate 🤔 I guess just adding a second sentence about that would help

cycles. If `T: Send` relies on `T: Send` then it's pretty clear that this will just go on forever.

With cycles we have to be careful with caching. Due to canonicalization of regions and inference
variables we also have to rerun queries until the provisional result returned when hitting the cycle
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you mentioned "provisional result" yet at this point so i expect nobody will know what this means. It also might be worth linking to https://hackmd.io/M5vJyLMGSTaeY0n96wqEWQ somewhere or inlining it since it steps through the "rerun queries until the provisional result" stuff.

lcnr and others added 2 commits January 12, 2023 15:23
Co-authored-by: Boxy <supbscripter@gmail.com>
lcnr and others added 2 commits January 13, 2023 10:23
Co-authored-by: Tshepang Mbambo <tshepang@gmail.com>

### 4. Normalization in empty environments results in a unique type

Normalization for alias types/consts has a unique result. Otherwise we can easily implement
Copy link
Member

Choose a reason for hiding this comment

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

Also it would be maybe a good idea to explain further. Like use an example of what would happen if you were to allow multiple results

While the exact approach to canonicalization for this solver will differ slightly
wrt to lifetimes, please visit [the relevant chalk chapter][chalk] for now.

As of 10<!-- date-check --> January 2023, canonicalization is not yet fully implemented
Copy link
Member

Choose a reason for hiding this comment

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

You can place the date inside the comment if it bothers the writing style :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure what exactly you mean here '^^ feel free to edit this section if you want 😁 i think it's a bit ugly rn but don't care too much.

Copy link
Member

@tshepang tshepang Jan 27, 2023

Choose a reason for hiding this comment

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

I would be something like...

<!-- date-check: jan 2023 -->
As of 10 January 2023,  canonicalization is not yet fully implemented
...

@spastorino
Copy link
Member

@lcnr I've left some minor comments. I'm fine to merge this after you address these nits, and we can keep improving it as we go.

@lcnr
Copy link
Contributor Author

lcnr commented Jan 27, 2023

👍 should have dealt with all your nits, thanks

Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

Let's merge this and iterate in-tree 😃

@compiler-errors compiler-errors merged commit c166632 into rust-lang:master Jan 27, 2023
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Jan 31, 2023
Update books

## rust-lang/book

2 commits in 2cd1b5593d26dc6a03c20f8619187ad4b2485552..f2a78f64b668f63f581203c6bac509903f7c00ee
2023-01-23 18:19:32 UTC to 2023-01-23 15:15:22 UTC

- Change CamelCase to UpperCamelCase
- Fix broken link to the No Starch Press version (rust-lang/book#3513)

## rust-embedded/book

3 commits in 19f798d448835a4888e3b3eae7fe69f1d61d8681..f1a4614aa41cc544b91b79760a709e113f3451d7
2023-01-26 15:21:58 UTC to 2023-01-18 07:51:06 UTC

- Fix typo in the registers.md (rust-embedded/book#343)
- Macports install instructions (rust-embedded/book#342)
- remove extern crate statements (rust-embedded/book#340)

## rust-lang/nomicon

2 commits in 960d610e7f33889a2577f5f17c26f0d5c82b30df..bd1829d235296952bf72ca55635e360584b8805e
2023-01-18 03:14:58 UTC to 2023-01-17 20:05:07 UTC

- Copyedits to FFI and unwinding section (rust-lang/nomicon#396)
- Fix typo in dropck documentation (rust-lang/nomicon#397)

## rust-lang/reference

2 commits in 2cb0ed9ba56360949f492f9866afe8c293f9f9da..22882fb3f7b4d69fdc0d1731e8b9cfcb6910537d
2023-01-23 13:21:28 UTC to 2023-01-20 18:38:44 UTC

- Fix typo “assigment” (…and more) (rust-lang/reference#1322)
- Syntax correction for trait-bounds.md (rust-lang/reference#1319)

## rust-lang/rust-by-example

1 commits in a9fb7d13eadfcc5f457962731f105b97f9a7474a..134376872e8c387ef369507e0ee9b5a0e3272718
2023-01-25 11:56:37 UTC to 2023-01-25 11:56:37 UTC

- update std_misc/file/create.md: fixed grammar (rust-lang/rust-by-example#1668)

## rust-lang/rustc-dev-guide

12 commits in 7352353ae91c48b136d2ca7d03822e1448165e1e..e359ee27fc3da3356d71a732128c0a1abe02e53a
2023-01-30 15:08:16 UTC to 2023-01-17 12:44:19 UTC

- New infcx usage (rust-lang/rustc-dev-guide#1571)
- Create a chapter for AST validation (rust-lang/rustc-dev-guide#1524)
- Use ephemeral PAT for linkcheck (rust-lang/rustc-dev-guide#1569)
- add section for the new trait solver (rust-lang/rustc-dev-guide#1551)
- version 5 is now not supported (rust-lang/rustc-dev-guide#1568)
- there are still no locale bundles (rust-lang/rustc-dev-guide#1567)
- bumpt date-check examples to current month (rust-lang/rustc-dev-guide#1566)
- Update hir.md (rust-lang/rustc-dev-guide#1565)
- rustc_typeck exists no more (rust-lang/rustc-dev-guide#1559)
- Correct tests misplacement (rust-lang/rustc-dev-guide#1564)
- Update resolution.md (rust-lang/rustc-dev-guide#1561)
- Update asm.md  (rust-lang/rustc-dev-guide#1560)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants