Skip to content

Commit edddf9f

Browse files
committed
More review changes
1 parent 5f58b0d commit edddf9f

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/chalk-overview.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
> Chalk is under heavy development, so if any of these links are broken or if
44
> any of the information is inconsistent with the code or outdated, please
5-
> [open an issue][rustc-issues] so we can fix it. If you are able to fix the issue yourself, we would
6-
> love your contribution!
5+
> [open an issue][rustc-issues] so we can fix it. If you are able to fix the
6+
> issue yourself, we would love your contribution!
77
88
[Chalk][chalk] recasts Rust's trait system explicitly in terms of logic
99
programming by "lowering" Rust code into a kind of logic program we can then
@@ -42,7 +42,7 @@ Rust-like syntax.
4242
The parser takes that syntax and produces an [Abstract Syntax Tree (AST)][ast].
4343
You can find the [complete definition of the AST][chalk-ast] in the source code.
4444

45-
The syntax contains things from Rust that we know and love for example traits,
45+
The syntax contains things from Rust that we know and love, for example: traits,
4646
impls, and struct definitions. Parsing is often the first "phase" of
4747
transformation that a program goes through in order to become a format that
4848
chalk can understand.
@@ -67,14 +67,14 @@ essentially one of the following:
6767
* `forall<T> { ... }` is represented in the code using the [`Binders<T>`
6868
struct][binders-struct].
6969

70-
This is the phase where we encode the rules of the trait system into logic. For
71-
example, if we have:
70+
Lowering is the phase where we encode the rules of the trait system into logic.
71+
For example, if we have the following Rust:
7272

7373
```rust,ignore
7474
impl<T: Clone> Clone for Vec<T> {}
7575
```
7676

77-
We generate:
77+
We generate the following program clause:
7878

7979
```rust,ignore
8080
forall<T> { (Vec<T>: Clone) :- (T: Clone) }
@@ -102,22 +102,23 @@ For example, if you have a type like `Foo<Bar>`, we would represent `Foo` as a
102102
string in the AST but in `ir::Program`, we use numeric indices (`ItemId`).
103103

104104
In addition to `ir::Program` which has "rust-like things", there is also
105-
`ir::ProgramEnvironment` which is "pure logic". The main field in that is
105+
`ir::ProgramEnvironment` which is "pure logic". The main field in that struct is
106106
`program_clauses` which contains the `ProgramClause`s that we generated
107107
previously.
108108

109109
## Rules
110110

111111
The `rules` module works by iterating over every trait, impl, etc. and emitting
112-
the rules that come from each one. The traits section of the rustc-guide (that
113-
you are currently reading) contains the most up-to-date reference on that.
112+
the rules that come from each one. See [Lowering Rules][lowering-rules] for the
113+
most up-to-date reference on that.
114114

115115
The `ir::ProgramEnvironment` is created [in this module][rules-environment].
116116

117117
## Testing
118118

119119
TODO: Basically, [there is a macro](https://github.com/rust-lang-nursery/chalk/blob/94a1941a021842a5fcb35cd043145c8faae59f08/src/solve/test.rs#L112-L148)
120-
that will take syntax and run it through the full pipeline described above.
120+
that will take chalk's Rust-like syntax and run it through the full pipeline
121+
described above.
121122
[This](https://github.com/rust-lang-nursery/chalk/blob/94a1941a021842a5fcb35cd043145c8faae59f08/src/solve/test.rs#L83-L110)
122123
is the function that is ultimately called.
123124

0 commit comments

Comments
 (0)