Skip to content

Commit 9d75fc1

Browse files
committed
Move IR descriptions into different chapter
1 parent e1e7dc8 commit 9d75fc1

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

book/src/SUMMARY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
- [Rust lifetimes](./types/rust_lifetimes.md)
1212
- [Operations](./types/operations.md)
1313
- [Fold and the Folder trait](./types/operations/fold.md)
14-
- [Intermediate representations](./rust_ir.md)
1514
- [Lowering Rust IR to logic](./clauses.md)
1615
- [Goals and clauses](./clauses/goals_and_clauses.md)
1716
- [Type equality and unification](./clauses/type_equality.md)

book/src/types.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Representing and manipulating Rust types
22

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+
321
## Goal of the chalk-ir crate
422

523
To have an ergonomic, flexible library that can abstractly represent
@@ -44,8 +62,8 @@ Chalk as of today to match this document:
4462
* Extract `TypeName` into something opaque to chalk-ir.
4563
* Dyn type equality should probably be driven by entailment.
4664
* 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.
4866
* Remove placeholders and projection placeholders from apply and create placeholder types.
4967
* Move `Error` from a `TypeName` to its own variant.
5068
* 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

Comments
 (0)