You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/doc/rustc-dev-guide/src/solve/invariants.md
+22-19Lines changed: 22 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -4,10 +4,10 @@ FIXME: This file talks about invariants of the type system as a whole, not only
4
4
5
5
There are a lot of invariants - things the type system guarantees to be true at all times -
6
6
which are desirable or expected from other languages and type systems. Unfortunately, quite
7
-
a few of them do not hold in Rust right now. This is either a fundamental to its design or
8
-
caused by bugs and something that may change in the future.
7
+
a few of them do not hold in Rust right now. This is either fundamental to its design or
8
+
caused by bugs, and something that may change in the future.
9
9
10
-
It is important to know about the things you can assume while working on - and with - the
10
+
It is important to know about the things you can assume while working on, and with, the
11
11
type system, so here's an incomplete and unofficial list of invariants of
12
12
the core type system:
13
13
@@ -29,14 +29,15 @@ If you have a some type and equate it to itself after replacing any regions with
29
29
inference variables in both the lhs and rhs, the now potentially structurally different
30
30
types should still be equal to each other.
31
31
32
-
Needed to prevent goals from succeeding in HIR typeck and then failing in MIR borrowck.
33
-
If this invariant is broken MIR typeck ends up failing with an ICE.
32
+
This is needed to prevent goals from succeeding in HIR typeck and then failing in MIR borrowck.
33
+
If this invariant is broken, MIR typeck ends up failing with an ICE.
34
34
35
35
### Applying inference results from a goal does not change its result ❌
36
36
37
37
TODO: this invariant is formulated in a weird way and needs to be elaborated.
38
38
Pretty much: I would like this check to only fail if there's a solver bug:
39
-
https://github.com/rust-lang/rust/blob/2ffeb4636b4ae376f716dc4378a7efb37632dc2d/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs#L391-L407 We should readd this check and see where it breaks :3
0 commit comments