@@ -19,10 +19,9 @@ use decoder::DecodeContext;
19
19
use encoder:: EncodeContext ;
20
20
21
21
use middle:: cstore:: { InlinedItem , InlinedItemRef } ;
22
- use rustc:: ty:: adjustment;
23
22
use rustc:: hir:: def;
24
23
use rustc:: hir:: def_id:: DefId ;
25
- use rustc:: ty:: { self , TyCtxt } ;
24
+ use rustc:: ty:: TyCtxt ;
26
25
27
26
use syntax:: ast;
28
27
@@ -128,12 +127,8 @@ enum Table {
128
127
Def ,
129
128
NodeType ,
130
129
ItemSubsts ,
131
- Freevars ,
132
- MethodMap ,
133
130
Adjustment ,
134
- UpvarCaptureMap ,
135
- ConstQualif ,
136
- CastKind
131
+ ConstQualif
137
132
}
138
133
139
134
fn encode_side_tables_for_id ( ecx : & mut EncodeContext , id : ast:: NodeId ) {
@@ -156,60 +151,11 @@ fn encode_side_tables_for_id(ecx: &mut EncodeContext, id: ast::NodeId) {
156
151
item_substs. substs . encode ( ecx) . unwrap ( ) ;
157
152
}
158
153
159
- if let Some ( fv) = tcx. freevars . borrow ( ) . get ( & id) {
160
- ecx. entry ( Table :: Freevars , id) ;
161
- fv. encode ( ecx) . unwrap ( ) ;
162
-
163
- for freevar in fv {
164
- ecx. entry ( Table :: UpvarCaptureMap , id) ;
165
- let def_id = freevar. def . def_id ( ) ;
166
- let var_id = tcx. map . as_local_node_id ( def_id) . unwrap ( ) ;
167
- let upvar_id = ty:: UpvarId {
168
- var_id : var_id,
169
- closure_expr_id : id
170
- } ;
171
- let upvar_capture = tcx. tables
172
- . borrow ( )
173
- . upvar_capture_map
174
- . get ( & upvar_id)
175
- . unwrap ( )
176
- . clone ( ) ;
177
- var_id. encode ( ecx) . unwrap ( ) ;
178
- upvar_capture. encode ( ecx) . unwrap ( ) ;
179
- }
180
- }
181
-
182
- let method_call = ty:: MethodCall :: expr ( id) ;
183
- if let Some ( method) = tcx. tables . borrow ( ) . method_map . get ( & method_call) {
184
- ecx. entry ( Table :: MethodMap , id) ;
185
- method_call. autoderef . encode ( ecx) . unwrap ( ) ;
186
- method. encode ( ecx) . unwrap ( ) ;
187
- }
188
-
189
154
if let Some ( adjustment) = tcx. tables . borrow ( ) . adjustments . get ( & id) {
190
- match * adjustment {
191
- adjustment:: AdjustDerefRef ( ref adj) => {
192
- for autoderef in 0 ..adj. autoderefs {
193
- let method_call = ty:: MethodCall :: autoderef ( id, autoderef as u32 ) ;
194
- if let Some ( method) = tcx. tables . borrow ( ) . method_map . get ( & method_call) {
195
- ecx. entry ( Table :: MethodMap , id) ;
196
- method_call. autoderef . encode ( ecx) . unwrap ( ) ;
197
- method. encode ( ecx) . unwrap ( ) ;
198
- }
199
- }
200
- }
201
- _ => { }
202
- }
203
-
204
155
ecx. entry ( Table :: Adjustment , id) ;
205
156
adjustment. encode ( ecx) . unwrap ( ) ;
206
157
}
207
158
208
- if let Some ( cast_kind) = tcx. cast_kinds . borrow ( ) . get ( & id) {
209
- ecx. entry ( Table :: CastKind , id) ;
210
- cast_kind. encode ( ecx) . unwrap ( ) ;
211
- }
212
-
213
159
if let Some ( qualif) = tcx. const_qualif_map . borrow ( ) . get ( & id) {
214
160
ecx. entry ( Table :: ConstQualif , id) ;
215
161
qualif. encode ( ecx) . unwrap ( ) ;
@@ -234,34 +180,10 @@ fn decode_side_tables(dcx: &mut DecodeContext, ast_doc: rbml::Doc) {
234
180
let item_substs = Decodable :: decode ( dcx) . unwrap ( ) ;
235
181
dcx. tcx ( ) . tables . borrow_mut ( ) . item_substs . insert ( id, item_substs) ;
236
182
}
237
- Table :: Freevars => {
238
- let fv_info = Decodable :: decode ( dcx) . unwrap ( ) ;
239
- dcx. tcx ( ) . freevars . borrow_mut ( ) . insert ( id, fv_info) ;
240
- }
241
- Table :: UpvarCaptureMap => {
242
- let upvar_id = ty:: UpvarId {
243
- var_id : Decodable :: decode ( dcx) . unwrap ( ) ,
244
- closure_expr_id : id
245
- } ;
246
- let ub = Decodable :: decode ( dcx) . unwrap ( ) ;
247
- dcx. tcx ( ) . tables . borrow_mut ( ) . upvar_capture_map . insert ( upvar_id, ub) ;
248
- }
249
- Table :: MethodMap => {
250
- let method_call = ty:: MethodCall {
251
- expr_id : id,
252
- autoderef : Decodable :: decode ( dcx) . unwrap ( )
253
- } ;
254
- let method = Decodable :: decode ( dcx) . unwrap ( ) ;
255
- dcx. tcx ( ) . tables . borrow_mut ( ) . method_map . insert ( method_call, method) ;
256
- }
257
183
Table :: Adjustment => {
258
184
let adj = Decodable :: decode ( dcx) . unwrap ( ) ;
259
185
dcx. tcx ( ) . tables . borrow_mut ( ) . adjustments . insert ( id, adj) ;
260
186
}
261
- Table :: CastKind => {
262
- let cast_kind = Decodable :: decode ( dcx) . unwrap ( ) ;
263
- dcx. tcx ( ) . cast_kinds . borrow_mut ( ) . insert ( id, cast_kind) ;
264
- }
265
187
Table :: ConstQualif => {
266
188
let qualif = Decodable :: decode ( dcx) . unwrap ( ) ;
267
189
dcx. tcx ( ) . const_qualif_map . borrow_mut ( ) . insert ( id, qualif) ;
0 commit comments