@@ -24,8 +24,7 @@ use metadata::tydecode::{DefIdSource, NominalType, TypeWithId, TypeParameter,
2424 RegionParameter } ;
2525use metadata:: tyencode;
2626use middle:: typeck:: { MethodCall , MethodCallee , MethodOrigin } ;
27- use middle:: { ty, typeck, moves} ;
28- use middle;
27+ use middle:: { ty, typeck} ;
2928use util:: ppaux:: ty_to_str;
3029
3130use syntax:: { ast, ast_map, ast_util, codemap, fold} ;
@@ -36,7 +35,6 @@ use syntax;
3635
3736use libc;
3837use std:: cast;
39- use std:: cell:: RefCell ;
4038use std:: io:: Seek ;
4139use std:: io:: MemWriter ;
4240use std:: rc:: Rc ;
@@ -52,15 +50,9 @@ use writer = serialize::ebml::writer;
5250#[ cfg( test) ] use syntax:: parse;
5351#[ cfg( test) ] use syntax:: print:: pprust;
5452
55- // Auxiliary maps of things to be encoded
56- pub struct Maps {
57- pub capture_map : RefCell < middle:: moves:: CaptureMap > ,
58- }
59-
6053struct DecodeContext < ' a > {
6154 cdata : & ' a cstore:: crate_metadata ,
6255 tcx : & ' a ty:: ctxt ,
63- maps : & ' a Maps
6456}
6557
6658struct ExtendedDecodeContext < ' a > {
@@ -84,8 +76,7 @@ pub type Encoder<'a> = writer::Encoder<'a, MemWriter>;
8476
8577pub fn encode_inlined_item ( ecx : & e:: EncodeContext ,
8678 ebml_w : & mut Encoder ,
87- ii : e:: InlinedItemRef ,
88- maps : & Maps ) {
79+ ii : e:: InlinedItemRef ) {
8980 let id = match ii {
9081 e:: IIItemRef ( i) => i. id ,
9182 e:: IIForeignRef ( i) => i. id ,
@@ -101,7 +92,7 @@ pub fn encode_inlined_item(ecx: &e::EncodeContext,
10192 ebml_w. start_tag ( c:: tag_ast as uint ) ;
10293 id_range. encode ( ebml_w) ;
10394 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) ;
10596 ebml_w. end_tag ( ) ;
10697
10798 debug ! ( "< Encoded inlined fn: {} ({})" ,
@@ -111,14 +102,12 @@ pub fn encode_inlined_item(ecx: &e::EncodeContext,
111102
112103pub fn decode_inlined_item ( cdata : & cstore:: crate_metadata ,
113104 tcx : & ty:: ctxt ,
114- maps : & Maps ,
115105 path : Vec < ast_map:: PathElem > ,
116106 par_doc : ebml:: Doc )
117107 -> Result < ast:: InlinedItem , Vec < ast_map:: PathElem > > {
118108 let dcx = & DecodeContext {
119109 cdata : cdata,
120110 tcx : tcx,
121- maps : maps
122111 } ;
123112 match par_doc. opt_child ( c:: tag_ast) {
124113 None => Err ( path) ,
@@ -551,32 +540,6 @@ impl tr for freevar_entry {
551540 }
552541}
553542
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-
580543// ______________________________________________________________________
581544// Encoding and decoding of MethodCallee
582545
@@ -935,7 +898,6 @@ impl<'a> write_tag_and_id for Encoder<'a> {
935898struct SideTableEncodingIdVisitor < ' a , ' b > {
936899 ecx_ptr : * libc:: c_void ,
937900 new_ebml_w : & ' a mut Encoder < ' b > ,
938- maps : & ' a Maps ,
939901}
940902
941903impl < ' a , ' b > ast_util:: IdVisitingOperation for
@@ -953,12 +915,11 @@ impl<'a,'b> ast_util::IdVisitingOperation for
953915 let ecx: & e:: EncodeContext = unsafe {
954916 cast:: transmute ( self . ecx_ptr )
955917 } ;
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)
957919 }
958920}
959921
960922fn encode_side_tables_for_ii ( ecx : & e:: EncodeContext ,
961- maps : & Maps ,
962923 ebml_w : & mut Encoder ,
963924 ii : & ast:: InlinedItem ) {
964925 ebml_w. start_tag ( c:: tag_table as uint ) ;
@@ -974,13 +935,11 @@ fn encode_side_tables_for_ii(ecx: &e::EncodeContext,
974935 cast:: transmute ( ecx)
975936 } ,
976937 new_ebml_w : & mut new_ebml_w,
977- maps : maps,
978938 } ) ;
979939 ebml_w. end_tag ( ) ;
980940}
981941
982942fn encode_side_tables_for_id ( ecx : & e:: EncodeContext ,
983- maps : & Maps ,
984943 ebml_w : & mut Encoder ,
985944 id : ast:: NodeId ) {
986945 let tcx = ecx. tcx ;
@@ -1096,17 +1055,6 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
10961055 } )
10971056 } )
10981057 }
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- }
11101058}
11111059
11121060trait doc_decoder_helpers {
@@ -1405,15 +1353,6 @@ fn decode_side_tables(xcx: &ExtendedDecodeContext,
14051353 let adj: ty:: AutoAdjustment = val_dsr. read_auto_adjustment ( xcx) ;
14061354 dcx. tcx . adjustments . borrow_mut ( ) . insert ( id, adj) ;
14071355 }
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- }
14171356 _ => {
14181357 xcx. dcx . tcx . sess . bug (
14191358 format ! ( "unknown tag found in side tables: {:x}" , tag) ) ;
0 commit comments