or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
I am overflowing with pain
handling non-fatal overflow in the new solver
Previous documents
Constraints when handling non-fatal overflow
Background information
Why do we have to support non-fatal overflow
We removed the
match_fresh_trait_refs
hack in the old solver as it is dificult to support this correctly. The existing implementation breaks query stability. Removing this causes overflow in multiple crates, including typenum (https://github.com/rust-lang/trait-system-refactor-initiative/issues/73) and the standard library.Completely erasing all constraints on overflow is breaking
Doing so would be incredible for performance, however, it would causes a regression: https://github.com/rust-lang/trait-system-refactor-initiative/issues/70 and https://github.com/AzureMarker/shaku
Erasing constraints on overflow is desirable
Returning constrains on overflow can easily cause
try_evaluate_added_goals
to hang. See https://github.com/rust-lang/rust/blob/master/tests/ui/traits/new-solver/cycles/inductive-fixpoint-hang.rs for an explanation of the issue.If we do not erase constraints, the depth at which overflow occured can easily change the response. Because of this the remaining depth is part of the cache key on overflow. This can end up being incredibly costly by rendering the cache to be pretty much useless. In case overflowing goals result in no constraints, we can add an optimization to reuse the cache entry for a goal on future accesses with a lower remaining depth.
What to do
I believe the breakage is limited to
project
in the old solver. We do not eagerly evaluate nested goals when normalizing, allowing an error when equating the normalized alias with the expected term to hide the actual overflow.While we could return constraints in more cases, this would not significantly improve the expressiveness of the trait solver while negatively affecting perf.
By only applying the constraints from overflow when normalizing, i.e. the current goal is
NormalizesTo
, while always ignoring constraints from nested where clauses, we should closely match the behavior of the old solver.