@@ -34,13 +34,12 @@ lazilly and on demand, and include logic that checks for cycles.
34
34
Demand is driven by calls to `AstConv::get_item_type_scheme` or
35
35
`AstConv::lookup_trait_def`.
36
36
37
- Currently, we "convert" types and traits in three phases (note that
37
+ Currently, we "convert" types and traits in two phases (note that
38
38
conversion only affects the types of items / enum variants / methods;
39
39
it does not e.g. compute the types of individual expressions):
40
40
41
41
0. Intrinsics
42
- 1. Trait definitions
43
- 2. Type definitions
42
+ 1. Trait/Type definitions
44
43
45
44
Conversion itself is done by simply walking each of the items in turn
46
45
and invoking an appropriate function (e.g., `trait_def_of_item` or
@@ -56,11 +55,6 @@ There are some shortcomings in this design:
56
55
- Because the type scheme includes defaults, cycles through type
57
56
parameter defaults are illegal even if those defaults are never
58
57
employed. This is not necessarily a bug.
59
- - The phasing of trait definitions before type definitions does not
60
- seem to be necessary, sufficient, or particularly helpful, given that
61
- processing a trait definition can trigger processing a type def and
62
- vice versa. However, if I remove it, I get ICEs, so some more work is
63
- needed in that area. -nmatsakis
64
58
65
59
*/
66
60
@@ -107,9 +101,6 @@ use rustc_front::print::pprust;
107
101
pub fn collect_item_types ( tcx : & ty:: ctxt ) {
108
102
let ccx = & CrateCtxt { tcx : tcx, stack : RefCell :: new ( Vec :: new ( ) ) } ;
109
103
110
- let mut visitor = CollectTraitDefVisitor { ccx : ccx } ;
111
- ccx. tcx . map . krate ( ) . visit_all_items ( & mut visitor) ;
112
-
113
104
let mut visitor = CollectItemTypesVisitor { ccx : ccx } ;
114
105
ccx. tcx . map . krate ( ) . visit_all_items ( & mut visitor) ;
115
106
}
@@ -149,28 +140,6 @@ enum AstConvRequest {
149
140
}
150
141
151
142
///////////////////////////////////////////////////////////////////////////
152
- // First phase: just collect *trait definitions* -- basically, the set
153
- // of type parameters and supertraits. This is information we need to
154
- // know later when parsing field defs.
155
-
156
- struct CollectTraitDefVisitor < ' a , ' tcx : ' a > {
157
- ccx : & ' a CrateCtxt < ' a , ' tcx >
158
- }
159
-
160
- impl < ' a , ' tcx , ' v > intravisit:: Visitor < ' v > for CollectTraitDefVisitor < ' a , ' tcx > {
161
- fn visit_item ( & mut self , i : & hir:: Item ) {
162
- match i. node {
163
- hir:: ItemTrait ( ..) => {
164
- // computing the trait def also fills in the table
165
- let _ = trait_def_of_item ( self . ccx , i) ;
166
- }
167
- _ => { }
168
- }
169
- }
170
- }
171
-
172
- ///////////////////////////////////////////////////////////////////////////
173
- // Second phase: collection proper.
174
143
175
144
struct CollectItemTypesVisitor < ' a , ' tcx : ' a > {
176
145
ccx : & ' a CrateCtxt < ' a , ' tcx >
0 commit comments