1
1
# Trait solving (new-style)
2
2
3
- 🚧 This chapter describes "new-style" trait solving. This is still in the
4
- [ process of being implemented] [ wg ] ; this chapter serves as a kind of
5
- in-progress design document. If you would prefer to read about how the
6
- current trait solver works, check out
7
- [ this other chapter] ( ./resolution.html ) . (By the way, if you
8
- would like to help in hacking on the new solver, you will find
9
- instructions for getting involved in the
10
- [ Traits Working Group tracking issue] [ wg ] .) 🚧
3
+ > 🚧 This chapter describes "new-style" trait solving. This is still in the
4
+ > [ process of being implemented] [ wg ] ; this chapter serves as a kind of
5
+ > in-progress design document. If you would prefer to read about how the
6
+ > current trait solver works, check out
7
+ > [ this other chapter] ( ./resolution.html ) . 🚧
8
+ >
9
+ > By the way, if you would like to help in hacking on the new solver, you will
10
+ > find instructions for getting involved in the
11
+ > [ Traits Working Group tracking issue] [ wg ] .
11
12
12
13
[ wg ] : https://github.com/rust-lang/rust/issues/48416
13
14
14
- Trait solving is based around a few key ideas:
15
+ The new-style trait solver is based on the work done in [ chalk] [ chalk ] . Chalk
16
+ recasts Rust's trait system explicitly in terms of logic programming. It does
17
+ this by "lowering" Rust code into a kind of logic program we can then execute
18
+ queries against.
19
+
20
+ You can read more about chalk itself in the
21
+ [ Overview of Chalk] ( ./chalk-overview.md ) section.
22
+
23
+ Trait solving in rustc is based around a few key ideas:
15
24
16
25
- [ Lowering to logic] ( ./lowering-to-logic.html ) , which expresses
17
26
Rust traits in terms of standard logical terms.
@@ -32,17 +41,23 @@ Trait solving is based around a few key ideas:
32
41
` Bar ` ?") once, and then apply that same result independently in many
33
42
different inference contexts.
34
43
35
- Note: this is not a complete list of topics. See the sidebar for more.
44
+ > This is not a complete list of topics. See the sidebar for more.
36
45
46
+ ## Ongoing work
37
47
The design of the new-style trait solving currently happens in two places:
38
- * The [ chalk] [ chalk ] repository is where we experiment with new ideas and
39
- designs for the trait system. It basically consists of a unit testing framework
40
- for the correctness and feasibility of the logical rules defining the new-style
41
- trait system. It also provides the [ ` chalk_engine ` ] [ chalk_engine ] crate, which
42
- defines the new-style trait solver used both in the unit testing framework and
43
- in rustc.
44
- * Once we are happy with the logical rules, we proceed to implementing them in
45
- rustc. This mainly happens in [ ` librustc_traits ` ] [ librustc_traits ] .
48
+
49
+ ** chalk** . The [ chalk] [ chalk ] repository is where we experiment with new ideas
50
+ and designs for the trait system. It primarily consists of two parts:
51
+ * a unit testing framework
52
+ for the correctness and feasibility of the logical rules defining the
53
+ new-style trait system.
54
+ * the [ ` chalk_engine ` ] [ chalk_engine ] crate, which
55
+ defines the new-style trait solver used both in the unit testing framework
56
+ and in rustc.
57
+
58
+ ** rustc** . Once we are happy with the logical rules, we proceed to
59
+ implementing them in rustc. This mainly happens in
60
+ [ ` librustc_traits ` ] [ librustc_traits ] .
46
61
47
62
[ chalk ] : https://github.com/rust-lang-nursery/chalk
48
63
[ chalk_engine ] : https://github.com/rust-lang-nursery/chalk/tree/master/chalk-engine
0 commit comments