@@ -70,16 +70,17 @@ impls, and struct definitions. Parsing is often the first "phase" of
7070transformation that a program goes through in order to become a format that
7171chalk can understand.
7272
73- ### Rust Intermediate Representation ([ rust_ir ] )
73+ ### Rust Intermediate Representation ([ chalk_rust_ir ] )
7474
7575After getting the AST we convert it to a more convenient intermediate
76- representation called [ ` rust_ir ` ] [ rust_ir ] . This is sort of analogous to the
77- [ HIR] in Rust. The process of converting to IR is called * lowering* .
76+ representation called [ ` chalk_rust_ir ` ] [ chalk_rust_ir ] . This is sort of
77+ analogous to the [ HIR] in Rust. The process of converting to IR is called
78+ * lowering* .
7879
79- The [ ` rust_ir:: Program` ] [ rust_ir -program] struct contains some "rust things"
80+ The [ ` chalk::program:: Program` ] [ chalk -program] struct contains some "rust things"
8081but indexed and accessible in a different way. For example, if you have a
8182type like ` Foo<Bar> ` , we would represent ` Foo ` as a string in the AST but in
82- ` rust_ir ::Program` , we use numeric indices (` ItemId ` ).
83+ ` chalk::program ::Program` , we use numeric indices (` ItemId ` ).
8384
8485The [ IR source code] [ ir-code ] contains the complete definition.
8586
@@ -120,14 +121,14 @@ forall<T> { (Vec<T>: Clone) :- (T: Clone) }
120121This rule dictates that ` Vec<T>: Clone ` is only satisfied if ` T: Clone ` is also
121122satisfied (i.e. "provable").
122123
123- Similar to [ ` rust_ir:: Program` ] [ rust_ir -program] which has "rust-like
124+ Similar to [ ` chalk::program:: Program` ] [ chalk -program] which has "rust-like
124125things", chalk_ir defines [ ` ProgramEnvironment ` ] which which is "pure logic".
125126The main field in that struct is ` program_clauses ` , which contains the
126127[ ` ProgramClause ` ] s generated by the rules module.
127128
128- #### Rules
129+ ### Rules ( [ chalk_rules ] )
129130
130- The ` rules ` module ([ source code] [ rules-src ] ) defines the logic rules we use
131+ The ` chalk_rules ` crate ([ source code] [ chalk_rules ] ) defines the logic rules we use
131132for each item in the Rust IR. It works by iterating over every trait, impl,
132133etc. and emitting the rules that come from each one.
133134
@@ -136,13 +137,13 @@ etc. and emitting the rules that come from each one.
136137#### Well-formedness checks
137138
138139As part of lowering to logic, we also do some "well formedness" checks. See
139- the [ ` rules ::wf` source code] [ rules-wf-src ] for where those are done.
140+ the [ ` chalk_rules ::wf` source code] [ rules-wf-src ] for where those are done.
140141
141142* See also: [ Well-formedness checking] [ wf-checking ] *
142143
143144#### Coherence
144145
145- The function ` record_specialization_priorities ` in the ` coherence ` module
146+ The method ` CoherenceSolver::specialization_priorities ` in the ` coherence ` module
146147([ source code] [ coherence-src ] ) checks "coherence", which means that it
147148ensures that two impls of the same trait for the same type cannot exist.
148149
@@ -158,18 +159,19 @@ queries is called the *solver*.
158159
159160Chalk's functionality is broken up into the following crates:
160161- [ ** chalk_engine** ] [ chalk_engine ] : Defines the core [ SLG solver] [ slg ] .
162+ - [ ** chalk_rust_ir** ] [ chalk_rust_ir ] , containing the "HIR-like" form of the AST
161163- [ ** chalk_ir** ] [ chalk_ir ] : Defines chalk's internal representation of
162164 types, lifetimes, and goals.
163165- [ ** chalk_solve** ] [ chalk_solve ] : Combines ` chalk_ir ` and ` chalk_engine ` ,
164166 effectively.
165167 - [ ` chalk_engine::context ` ] [ engine-context ] provides the necessary hooks.
166168- [ ** chalk_parse** ] [ chalk_parse ] : Defines the raw AST and a parser.
169+ - [ ** chalk_rules** ] [ chalk_rules ] : which implements logic rules converting
170+ ` chalk_rust_ir ` to ` chalk_ir `
171+ - Defines the ` coherence ` module, which implements coherence rules
167172- [ ** chalk** ] [ doc-chalk ] : Brings everything together. Defines the following
168173 modules:
169- - [ ` rust_ir ` ] [ rust_ir ] , containing the "HIR-like" form of the AST
170- - ` rust_ir::lowering ` , which converts AST to ` rust_ir `
171- - ` rules ` , which implements logic rules converting ` rust_ir ` to ` chalk_ir `
172- - ` coherence ` , which implements coherence rules
174+ - ` chalk::lowering ` , which converts AST to ` chalk_rust_ir `
173175 - Also includes [ chalki] [ chalki ] , chalk's REPL.
174176
175177[ Browse source code on GitHub] ( https://github.com/rust-lang/chalk )
@@ -188,7 +190,7 @@ which is expected to lower to logic successfully, and a set of queries
188190tests support specifying only a prefix of the output.
189191
190192** Lowering tests** check the stages that occur before we can issue queries
191- to the solver: the [ lowering to rust_ir ] [ chalk-test-lowering ] , and the
193+ to the solver: the [ lowering to chalk_rust_ir ] [ chalk-test-lowering ] , and the
192194[ well-formedness checks] [ chalk-test-wf ] that occur after that.
193195
194196### Testing internals
@@ -229,29 +231,28 @@ Likewise, lowering tests use the [`lowering_success!` and
229231[ universal quantification ] : https://en.wikipedia.org/wiki/Universal_quantification
230232
231233[ `ProgramClause` ] : https://rust-lang.github.io/chalk/doc/chalk_ir/enum.ProgramClause.html
232- [ `ProgramEnvironment` ] : https ://rust-lang.github.io/chalk/doc/chalk_ir /struct.ProgramEnvironment.html
234+ [ `ProgramEnvironment` ] : http ://rust-lang.github.io/chalk/doc/chalk/program_environment /struct.ProgramEnvironment.html
233235[ chalk_engine ] : https://rust-lang.github.io/chalk/doc/chalk_engine/index.html
234236[ chalk_ir ] : https://rust-lang.github.io/chalk/doc/chalk_ir/index.html
235237[ chalk_parse ] : https://rust-lang.github.io/chalk/doc/chalk_parse/index.html
236238[ chalk_solve ] : https://rust-lang.github.io/chalk/doc/chalk_solve/index.html
239+ [ chalk_rules ] : https://rust-lang.github.io/chalk/doc/chalk_rules/index.html
240+ [ chalk_rust_ir ] : https://rust-lang.github.io/chalk/doc/chalk_rust_ir/index.html
237241[ doc-chalk ] : https://rust-lang.github.io/chalk/doc/chalk/index.html
238242[ engine-context ] : https://rust-lang.github.io/chalk/doc/chalk_engine/context/index.html
239- [ rust_ir-program ] : https://rust-lang.github.io/chalk/doc/chalk/rust_ir/struct.Program.html
240- [ rust_ir ] : https://rust-lang.github.io/chalk/doc/chalk/rust_ir/index.html
243+ [ chalk-program ] : http://rust-lang.github.io/chalk/doc/chalk/program/struct.Program.html
241244
242- [ binders-struct ] : https ://github.com/ rust-lang/chalk/blob/94a1941a021842a5fcb35cd043145c8faae59f08/src/ir.rs#L661
243- [ chalk-ast ] : https ://github.com/ rust-lang/chalk/blob/master/chalk-parse/src/ ast.rs
245+ [ binders-struct ] : http ://rust-lang.github.io /chalk/doc/chalk_ir/struct.Binders.html
246+ [ chalk-ast ] : http ://rust-lang.github.io /chalk/doc/chalk_parse/ ast/index.html
244247[ chalk-test-example ] : https://github.com/rust-lang/chalk/blob/4bce000801de31bf45c02f742a5fce335c9f035f/src/test.rs#L115
245248[ chalk-test-lowering-example ] : https://github.com/rust-lang/chalk/blob/4bce000801de31bf45c02f742a5fce335c9f035f/src/rust_ir/lowering/test.rs#L8-L31
246249[ chalk-test-lowering ] : https://github.com/rust-lang/chalk/blob/4bce000801de31bf45c02f742a5fce335c9f035f/src/rust_ir/lowering/test.rs
247250[ chalk-test-wf ] : https://github.com/rust-lang/chalk/blob/4bce000801de31bf45c02f742a5fce335c9f035f/src/rules/wf/test.rs#L1
248251[ chalki ] : https://rust-lang.github.io/chalk/doc/chalki/index.html
249252[ clause ] : https://github.com/rust-lang/chalk/blob/master/GLOSSARY.md#clause
250- [ coherence-src ] : https://github.com/rust-lang/chalk/blob/master/src/coherence.rs
251- [ ir-code ] : https://github.com/rust-lang/chalk/blob/master/src/rust_ir.rs
252- [ rules-environment ] : https://github.com/rust-lang/chalk/blob/94a1941a021842a5fcb35cd043145c8faae59f08/src/rules.rs#L9
253- [ rules-src ] : https://github.com/rust-lang/chalk/blob/4bce000801de31bf45c02f742a5fce335c9f035f/src/rules.rs
254- [ rules-wf-src ] : https://github.com/rust-lang/chalk/blob/4bce000801de31bf45c02f742a5fce335c9f035f/src/rules/wf.rs
253+ [ coherence-src ] : http://rust-lang.github.io/chalk/doc/chalk_rules/coherence/index.html
254+ [ ir-code ] : http://rust-lang.github.io/chalk/doc/chalk_rust_ir/
255+ [ rules-wf-src ] : http://rust-lang.github.io/chalk/doc/chalk_rules/wf/index.html
255256[ solve_goal ] : https://github.com/rust-lang/chalk/blob/4bce000801de31bf45c02f742a5fce335c9f035f/src/test.rs#L85
256257[ test-lowering-macros ] : https://github.com/rust-lang/chalk/blob/4bce000801de31bf45c02f742a5fce335c9f035f/src/test_util.rs#L21-L54
257258[ test-macro ] : https://github.com/rust-lang/chalk/blob/4bce000801de31bf45c02f742a5fce335c9f035f/src/test.rs#L33
0 commit comments