@@ -19,7 +19,7 @@ extend.
19
19
## Chalk Structure
20
20
21
21
Chalk has two main "products". The first of these is the
22
- [ ` chalk_engine ` ] [ doc-chalk-engine ] crate, which defines the core [ SLG
22
+ [ ` chalk_engine ` ] [ chalk_engine ] crate, which defines the core [ SLG
23
23
solver] [ slg ] . This is the part rustc uses.
24
24
25
25
The rest of chalk can be considered an elaborate testing harness. Chalk is
@@ -53,8 +53,6 @@ You can see more examples of programs and queries in the [unit tests][chalk-test
53
53
54
54
Next we'll go through each stage required to produce the output above.
55
55
56
- [ chalk-tests ] : https://github.com/rust-lang-nursery/chalk/blob/4bce000801de31bf45c02f742a5fce335c9f035f/src/test.rs#L115
57
-
58
56
### Parsing ([ chalk_parse] )
59
57
60
58
Chalk is designed to be incorporated with the Rust compiler, so the syntax and
@@ -134,27 +132,19 @@ etc. and emitting the rules that come from each one.
134
132
135
133
* See also: [ Lowering Rules] [ lowering-rules ] *
136
134
137
- [ `ProgramEnvironment` ] : https://rust-lang-nursery.github.io/chalk/doc/chalk_ir/struct.ProgramEnvironment.html
138
- [ `ProgramClause` ] : https://rust-lang-nursery.github.io/chalk/doc/chalk_ir/enum.ProgramClause.html
139
- [ rules-src ] : https://github.com/rust-lang-nursery/chalk/blob/4bce000801de31bf45c02f742a5fce335c9f035f/src/rules.rs
140
-
141
135
#### Well-formedness checks
142
136
143
137
As part of lowering to logic, we also do some "well formedness" checks. See
144
138
the [ ` rules::wf ` source code] [ rules-wf-src ] for where those are done.
145
139
146
140
* See also: [ Well-formedness checking] [ wf-checking ] *
147
141
148
- [ rules-wf-src ] : https://github.com/rust-lang-nursery/chalk/blob/4bce000801de31bf45c02f742a5fce335c9f035f/src/rules/wf.rs
149
-
150
142
#### Coherence
151
143
152
144
The function ` record_specialization_priorities ` in the ` coherence ` module
153
145
([ source code] [ coherence-src ] ) checks "coherence", which means that it
154
146
ensures that two impls of the same trait for the same type cannot exist.
155
147
156
- [ coherence-src ] : https://github.com/rust-lang-nursery/chalk/blob/master/src/coherence.rs
157
-
158
148
### Solver ([ chalk_solve] )
159
149
160
150
Finally, when we've collected all the program clauses we care about, we want
@@ -166,10 +156,10 @@ queries is called the *solver*.
166
156
## Crates
167
157
168
158
Chalk's functionality is broken up into the following crates:
169
- - [ ** chalk_engine** ] [ doc-chalk-engine ] : Defines the core [ SLG solver] [ slg ] .
159
+ - [ ** chalk_engine** ] [ chalk_engine ] : Defines the core [ SLG solver] [ slg ] .
170
160
- [ ** chalk_ir** ] [ chalk_ir ] : Defines chalk's internal representation of
171
161
types, lifetimes, and goals.
172
- - [ ** chalk_solve** ] [ doc-chalk-solve ] : Combines ` chalk_ir ` and ` chalk_engine ` ,
162
+ - [ ** chalk_solve** ] [ chalk_solve ] : Combines ` chalk_ir ` and ` chalk_engine ` ,
173
163
effectively.
174
164
- [ ` chalk_engine::context ` ] [ engine-context ] provides the necessary hooks.
175
165
- [ ** chalk_parse** ] [ chalk_parse ] : Defines the raw AST and a parser.
@@ -179,20 +169,9 @@ Chalk's functionality is broken up into the following crates:
179
169
- ` rust_ir::lowering ` , which converts AST to ` rust_ir `
180
170
- ` rules ` , which implements logic rules converting ` rust_ir ` to ` chalk_ir `
181
171
- ` coherence ` , which implements coherence rules
182
- - Also includes [ chalki] [ doc-chalki ] , chalk's REPL.
183
-
184
- [ Browse source on GitHub] ( https://github.com/rust-lang-nursery/chalk )
185
-
186
- [ engine-context ] : https://rust-lang-nursery.github.io/chalk/doc/chalk_engine/context/index.html
172
+ - Also includes [ chalki] [ chalki ] , chalk's REPL.
187
173
188
- [ doc-chalk-engine ] : https://rust-lang-nursery.github.io/chalk/doc/chalk_engine/index.html
189
- [ chalk_ir ] : https://rust-lang-nursery.github.io/chalk/doc/chalk_ir/index.html
190
- [ doc-chalk-solve ] : https://rust-lang-nursery.github.io/chalk/doc/chalk_solve/index.html
191
- [ chalk_parse ] : https://rust-lang-nursery.github.io/chalk/doc/chalk_parse/index.html
192
- [ doc-chalk ] : https://rust-lang-nursery.github.io/chalk/doc/chalk/index.html
193
- [ rust_ir ] : https://rust-lang-nursery.github.io/chalk/doc/chalk/rust_ir/index.html
194
- [ rust_ir-program ] : https://rust-lang-nursery.github.io/chalk/doc/chalk/rust_ir/struct.Program.html
195
- [ doc-chalki ] : https://rust-lang-nursery.github.io/chalk/doc/chalki/index.html
174
+ [ Browse source code on GitHub] ( https://github.com/rust-lang-nursery/chalk )
196
175
197
176
## Testing
198
177
@@ -217,19 +196,37 @@ is the function that is ultimately called.
217
196
* [ Cyclic queries in chalk] ( http://smallcultfollowing.com/babysteps/blog/2017/09/12/tabling-handling-cyclic-queries-in-chalk/ )
218
197
* [ An on-demand SLG solver for chalk] ( http://smallcultfollowing.com/babysteps/blog/2018/01/31/an-on-demand-slg-solver-for-chalk/ )
219
198
220
- [ rustc-issues ] : https://github.com/rust-lang-nursery/rustc-guide/issues
221
- [ chalk ] : https://github.com/rust-lang-nursery/chalk
222
- [ lowering-to-logic ] : ./lowering-to-logic.html
199
+ [ goals-and-clauses ] : ./goals-and-clauses.html
200
+ [ HIR ] : ../hir.html
201
+ [ lowering-forall ] : ./lowering-to-logic.html#type-checking-generic-functions-beyond-horn-clauses
223
202
[ lowering-rules ] : ./lowering-rules.html
203
+ [ lowering-to-logic ] : ./lowering-to-logic.html
204
+ [ slg ] : ./slg.html
224
205
[ wf-checking ] : ./wf.html
206
+
225
207
[ ast ] : https://en.wikipedia.org/wiki/Abstract_syntax_tree
226
- [ chalk-ast ] : https://github.com/rust-lang-nursery/chalk/blob/master/chalk-parse/src/ast.rs
208
+ [ chalk ] : https://github.com/rust-lang-nursery/chalk
209
+ [ rustc-issues ] : https://github.com/rust-lang-nursery/rustc-guide/issues
227
210
[ universal quantification ] : https://en.wikipedia.org/wiki/Universal_quantification
228
- [ lowering-forall ] : ./lowering-to-logic.html#type-checking-generic-functions-beyond-horn-clauses
211
+
212
+ [ `ProgramClause` ] : https://rust-lang-nursery.github.io/chalk/doc/chalk_ir/enum.ProgramClause.html
213
+ [ `ProgramEnvironment` ] : https://rust-lang-nursery.github.io/chalk/doc/chalk_ir/struct.ProgramEnvironment.html
214
+ [ chalk_engine ] : https://rust-lang-nursery.github.io/chalk/doc/chalk_engine/index.html
215
+ [ chalk_ir ] : https://rust-lang-nursery.github.io/chalk/doc/chalk_ir/index.html
216
+ [ chalk_parse ] : https://rust-lang-nursery.github.io/chalk/doc/chalk_parse/index.html
217
+ [ chalk_solve ] : https://rust-lang-nursery.github.io/chalk/doc/chalk_solve/index.html
218
+ [ doc-chalk ] : https://rust-lang-nursery.github.io/chalk/doc/chalk/index.html
219
+ [ engine-context ] : https://rust-lang-nursery.github.io/chalk/doc/chalk_engine/context/index.html
220
+ [ rust_ir-program ] : https://rust-lang-nursery.github.io/chalk/doc/chalk/rust_ir/struct.Program.html
221
+ [ rust_ir ] : https://rust-lang-nursery.github.io/chalk/doc/chalk/rust_ir/index.html
222
+
223
+ [ binders-struct ] : https://github.com/rust-lang-nursery/chalk/blob/94a1941a021842a5fcb35cd043145c8faae59f08/src/ir.rs#L661
224
+ [ chalk-ast ] : https://github.com/rust-lang-nursery/chalk/blob/master/chalk-parse/src/ast.rs
225
+ [ chalk-tests ] : https://github.com/rust-lang-nursery/chalk/blob/4bce000801de31bf45c02f742a5fce335c9f035f/src/test.rs#L115
226
+ [ chalki ] : https://rust-lang-nursery.github.io/chalk/doc/chalki/index.html
229
227
[ clause ] : https://github.com/rust-lang-nursery/chalk/blob/master/GLOSSARY.md#clause
230
- [ goals-and-clauses ] : ./goals-and-clauses.html
228
+ [ coherence-src ] : https://github.com/rust-lang-nursery/chalk/blob/master/src/coherence.rs
231
229
[ ir-code ] : https://github.com/rust-lang-nursery/chalk/blob/master/src/rust_ir.rs
232
- [ HIR ] : ../hir.html
233
- [ binders-struct ] : https://github.com/rust-lang-nursery/chalk/blob/94a1941a021842a5fcb35cd043145c8faae59f08/src/ir.rs#L661
234
230
[ rules-environment ] : https://github.com/rust-lang-nursery/chalk/blob/94a1941a021842a5fcb35cd043145c8faae59f08/src/rules.rs#L9
235
- [ slg ] : ./slg.html
231
+ [ rules-src ] : https://github.com/rust-lang-nursery/chalk/blob/4bce000801de31bf45c02f742a5fce335c9f035f/src/rules.rs
232
+ [ rules-wf-src ] : https://github.com/rust-lang-nursery/chalk/blob/4bce000801de31bf45c02f742a5fce335c9f035f/src/rules/wf.rs
0 commit comments