@@ -24,8 +24,7 @@ use metadata::tydecode::{DefIdSource, NominalType, TypeWithId, TypeParameter,
24
24
RegionParameter } ;
25
25
use metadata:: tyencode;
26
26
use middle:: typeck:: { MethodCall , MethodCallee , MethodOrigin } ;
27
- use middle:: { ty, typeck, moves} ;
28
- use middle;
27
+ use middle:: { ty, typeck} ;
29
28
use util:: ppaux:: ty_to_str;
30
29
31
30
use syntax:: { ast, ast_map, ast_util, codemap, fold} ;
@@ -36,7 +35,6 @@ use syntax;
36
35
37
36
use libc;
38
37
use std:: cast;
39
- use std:: cell:: RefCell ;
40
38
use std:: io:: Seek ;
41
39
use std:: io:: MemWriter ;
42
40
use std:: rc:: Rc ;
@@ -52,15 +50,9 @@ use writer = serialize::ebml::writer;
52
50
#[ cfg( test) ] use syntax:: parse;
53
51
#[ cfg( test) ] use syntax:: print:: pprust;
54
52
55
- // Auxiliary maps of things to be encoded
56
- pub struct Maps {
57
- pub capture_map : RefCell < middle:: moves:: CaptureMap > ,
58
- }
59
-
60
53
struct DecodeContext < ' a > {
61
54
cdata : & ' a cstore:: crate_metadata ,
62
55
tcx : & ' a ty:: ctxt ,
63
- maps : & ' a Maps
64
56
}
65
57
66
58
struct ExtendedDecodeContext < ' a > {
@@ -84,8 +76,7 @@ pub type Encoder<'a> = writer::Encoder<'a, MemWriter>;
84
76
85
77
pub fn encode_inlined_item ( ecx : & e:: EncodeContext ,
86
78
ebml_w : & mut Encoder ,
87
- ii : e:: InlinedItemRef ,
88
- maps : & Maps ) {
79
+ ii : e:: InlinedItemRef ) {
89
80
let id = match ii {
90
81
e:: IIItemRef ( i) => i. id ,
91
82
e:: IIForeignRef ( i) => i. id ,
@@ -101,7 +92,7 @@ pub fn encode_inlined_item(ecx: &e::EncodeContext,
101
92
ebml_w. start_tag ( c:: tag_ast as uint ) ;
102
93
id_range. encode ( ebml_w) ;
103
94
encode_ast ( ebml_w, ii) ;
104
- encode_side_tables_for_ii ( ecx, maps , ebml_w, & ii) ;
95
+ encode_side_tables_for_ii ( ecx, ebml_w, & ii) ;
105
96
ebml_w. end_tag ( ) ;
106
97
107
98
debug ! ( "< Encoded inlined fn: {} ({})" ,
@@ -111,14 +102,12 @@ pub fn encode_inlined_item(ecx: &e::EncodeContext,
111
102
112
103
pub fn decode_inlined_item ( cdata : & cstore:: crate_metadata ,
113
104
tcx : & ty:: ctxt ,
114
- maps : & Maps ,
115
105
path : Vec < ast_map:: PathElem > ,
116
106
par_doc : ebml:: Doc )
117
107
-> Result < ast:: InlinedItem , Vec < ast_map:: PathElem > > {
118
108
let dcx = & DecodeContext {
119
109
cdata : cdata,
120
110
tcx : tcx,
121
- maps : maps
122
111
} ;
123
112
match par_doc. opt_child ( c:: tag_ast) {
124
113
None => Err ( path) ,
@@ -551,32 +540,6 @@ impl tr for freevar_entry {
551
540
}
552
541
}
553
542
554
- // ______________________________________________________________________
555
- // Encoding and decoding of CaptureVar information
556
-
557
- trait capture_var_helper {
558
- fn read_capture_var ( & mut self , xcx : & ExtendedDecodeContext )
559
- -> moves:: CaptureVar ;
560
- }
561
-
562
- impl < ' a > capture_var_helper for reader:: Decoder < ' a > {
563
- fn read_capture_var ( & mut self , xcx : & ExtendedDecodeContext )
564
- -> moves:: CaptureVar {
565
- let cvar: moves:: CaptureVar = Decodable :: decode ( self ) . unwrap ( ) ;
566
- cvar. tr ( xcx)
567
- }
568
- }
569
-
570
- impl tr for moves:: CaptureVar {
571
- fn tr ( & self , xcx : & ExtendedDecodeContext ) -> moves:: CaptureVar {
572
- moves:: CaptureVar {
573
- def : self . def . tr ( xcx) ,
574
- span : self . span . tr ( xcx) ,
575
- mode : self . mode
576
- }
577
- }
578
- }
579
-
580
543
// ______________________________________________________________________
581
544
// Encoding and decoding of MethodCallee
582
545
@@ -935,7 +898,6 @@ impl<'a> write_tag_and_id for Encoder<'a> {
935
898
struct SideTableEncodingIdVisitor < ' a , ' b > {
936
899
ecx_ptr : * libc:: c_void ,
937
900
new_ebml_w : & ' a mut Encoder < ' b > ,
938
- maps : & ' a Maps ,
939
901
}
940
902
941
903
impl < ' a , ' b > ast_util:: IdVisitingOperation for
@@ -953,12 +915,11 @@ impl<'a,'b> ast_util::IdVisitingOperation for
953
915
let ecx: & e:: EncodeContext = unsafe {
954
916
cast:: transmute ( self . ecx_ptr )
955
917
} ;
956
- encode_side_tables_for_id ( ecx, self . maps , & mut new_ebml_w, id)
918
+ encode_side_tables_for_id ( ecx, & mut new_ebml_w, id)
957
919
}
958
920
}
959
921
960
922
fn encode_side_tables_for_ii ( ecx : & e:: EncodeContext ,
961
- maps : & Maps ,
962
923
ebml_w : & mut Encoder ,
963
924
ii : & ast:: InlinedItem ) {
964
925
ebml_w. start_tag ( c:: tag_table as uint ) ;
@@ -974,13 +935,11 @@ fn encode_side_tables_for_ii(ecx: &e::EncodeContext,
974
935
cast:: transmute ( ecx)
975
936
} ,
976
937
new_ebml_w : & mut new_ebml_w,
977
- maps : maps,
978
938
} ) ;
979
939
ebml_w. end_tag ( ) ;
980
940
}
981
941
982
942
fn encode_side_tables_for_id ( ecx : & e:: EncodeContext ,
983
- maps : & Maps ,
984
943
ebml_w : & mut Encoder ,
985
944
id : ast:: NodeId ) {
986
945
let tcx = ecx. tcx ;
@@ -1096,17 +1055,6 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
1096
1055
} )
1097
1056
} )
1098
1057
}
1099
-
1100
- for & cap_vars in maps. capture_map . borrow ( ) . find ( & id) . iter ( ) {
1101
- ebml_w. tag ( c:: tag_table_capture_map, |ebml_w| {
1102
- ebml_w. id ( id) ;
1103
- ebml_w. tag ( c:: tag_table_val, |ebml_w| {
1104
- ebml_w. emit_from_vec ( cap_vars. as_slice ( ) , |ebml_w, cap_var| {
1105
- cap_var. encode ( ebml_w)
1106
- } ) ;
1107
- } )
1108
- } )
1109
- }
1110
1058
}
1111
1059
1112
1060
trait doc_decoder_helpers {
@@ -1405,15 +1353,6 @@ fn decode_side_tables(xcx: &ExtendedDecodeContext,
1405
1353
let adj: ty:: AutoAdjustment = val_dsr. read_auto_adjustment ( xcx) ;
1406
1354
dcx. tcx . adjustments . borrow_mut ( ) . insert ( id, adj) ;
1407
1355
}
1408
- c:: tag_table_capture_map => {
1409
- let cvars =
1410
- val_dsr. read_to_vec (
1411
- |val_dsr| Ok ( val_dsr. read_capture_var ( xcx) ) )
1412
- . unwrap ( )
1413
- . move_iter ( )
1414
- . collect ( ) ;
1415
- dcx. maps . capture_map . borrow_mut ( ) . insert ( id, Rc :: new ( cvars) ) ;
1416
- }
1417
1356
_ => {
1418
1357
xcx. dcx . tcx . sess . bug (
1419
1358
format ! ( "unknown tag found in side tables: {:x}" , tag) ) ;
0 commit comments