|
1 | 1 | # Representing and manipulating Rust types
|
2 | 2 |
|
| 3 | +## Intermediate representations |
| 4 | + |
| 5 | +Intermediate representations (IR) are used to represent parts of Rust programs such as traits and impls. |
| 6 | + |
| 7 | +Chalk contains three levels of IR: |
| 8 | + |
| 9 | +- The **AST**. This is used purely for writing test cases |
| 10 | + with a Rust-like syntax. This is consumed by **lowering** code, which |
| 11 | + takes AST and products **Rust IR** (the next bullet point). |
| 12 | +- The **Rust IR**. This is a "HIR-like" notation that defines the |
| 13 | + interesting properties of things like traits, impls, and structs. |
| 14 | + It is an input to the **rules** code, which produces |
| 15 | +- The **Chalk IR**. This is most "Prolog-like" of the various IRs. It |
| 16 | + contains the definition of **types** as well as prolog-like concepts |
| 17 | + such as goals (things that must be proven true) and clauses (things |
| 18 | + that are assumed to be true). |
| 19 | + |
| 20 | + |
3 | 21 | ## Goal of the chalk-ir crate
|
4 | 22 |
|
5 | 23 | To have an ergonomic, flexible library that can abstractly represent
|
@@ -44,8 +62,8 @@ Chalk as of today to match this document:
|
44 | 62 | * Extract `TypeName` into something opaque to chalk-ir.
|
45 | 63 | * Dyn type equality should probably be driven by entailment.
|
46 | 64 | * Projections need to be renamed to aliases.
|
47 |
| -* The variant we use for impl traits should be removed and folded into type aliases. |
| 65 | +* The variant we use for impl traits should be removed and folded into type aliases. |
48 | 66 | * Remove placeholders and projection placeholders from apply and create placeholder types.
|
49 | 67 | * Move `Error` from a `TypeName` to its own variant.
|
50 | 68 | * Introduce `GeneratorWitness` into chalk
|
51 |
| -* Complete transition from `ForAll` to `Fn` in chalk |
| 69 | +* Complete transition from `ForAll` to `Fn` in chalk |
0 commit comments