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.
Syncing
xxxxxxxxxx
coinductive trait semantics issues
NormalizesTo
encounters unexpected cyclesProving
NormalizesTo
via an impl must not prove the super trait bounds, we otherwise get unproductive cycles:u32: Trait
requires super trait boundu32: Super<<u32 as Trait>::Assoc>
requires normalizing<u32 as Trait>::Assoc
which would then requireu32: Super<<u32 as Trait>::Assoc>
yet again, causing a cycleIt is sound to not check the super trait bounds for
NormalizesTo
goals as we only elaborate trait goals. However, we currently do so by accident when computingTraitGoalProvenVia
to merge candidates: source.Solution
Add a way to probe coinductively which treats the act of entering a probe as being coinductive. We should ideally check that this probe doesn't rely on any of the current inference state as this probe should be treated as a separate goal.
Inductive cycles always resulting in errors is yikes
Rigid associated types
Normalizing the associated type of that impl results in an inductive cycle. This cycle causes normalization to fail. We still treat the associated item as rigid as
T: Overflow
does hold.Solution
Change the way we compute whether an alias is supposed to be rigid, see https://github.com/rust-lang/rust/pull/136863.
Ignored where-bounds
T::Assoc
is treated as rigid inside oftest
. We pretty much entirely ignore theProjection
where-clause as it always errors due to an inductive cycle. This example therefore compiles. This feels somewhat odd.It interacts with https://github.com/rust-lang/trait-system-refactor-initiative/issues/1:
This mostly erases the difference between assumptions and requirements as we no longer overflow when trying to apply a cyclic where-clause
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →This introduces a new item bounds unsoundness
A variation of https://github.com/rust-lang/rust/issues/135246, using cyclic reasoning
when normalizing the environment from the impl definition while checking the item bounds.
Proving super trait bounds has a very large performance cost
Proving
TyCtxt<'tcx>: Interner
requires proving the super trait boundsTyCtxt<'tcx>: IrPrint<T>
for 12 differentT
. The impl for which requires provingT: Copy
which requires provingT: Clone
which requires provingTyCtxt<'tcx>: Interner
cycleTyCtxt<'tcx>: Interner
cycleT: Sized
, this requires<TyCtxt<'tcx> as Interner>::Assoc: Sized
for some of theT
¹TyCtxt<'tcx>: Interner
but also requires provingTyCtxt<'tcx>: IrPrint<T>
for the 12T
again¹ proving
Sized
requires proving theadt_sized_constraint
which isSome(<I as Interner>::Assoc)
if that associated type is the last field ofT
, even ifAssoc
has aSized
item-bound. We only filter sized constraints by looking forLastField: Sized
bounds inpredicates_of
. We do not look at item bounds or elaborated where-bounds.TODO
We may want to treat some cycles as overflowing instead of hard errors. Likely by having some sort of 3 notions of productivity for cycles: