@@ -16,13 +16,15 @@ use c = metadata::common;
1616use cstore = metadata:: cstore;
1717use driver:: session:: Session ;
1818use metadata:: decoder;
19+ use middle:: def;
1920use e = metadata:: encoder;
2021use middle:: freevars:: freevar_entry;
2122use middle:: region;
2223use metadata:: tydecode;
2324use metadata:: tydecode:: { DefIdSource , NominalType , TypeWithId , TypeParameter ,
2425 RegionParameter } ;
2526use metadata:: tyencode;
27+ use middle:: subst;
2628use middle:: typeck:: { MethodCall , MethodCallee , MethodOrigin } ;
2729use middle:: { ty, typeck} ;
2830use util:: ppaux:: ty_to_str;
@@ -394,58 +396,58 @@ fn renumber_and_map_ast(xcx: &ExtendedDecodeContext,
394396// ______________________________________________________________________
395397// Encoding and decoding of ast::def
396398
397- fn decode_def ( xcx : & ExtendedDecodeContext , doc : ebml:: Doc ) -> ast :: Def {
399+ fn decode_def ( xcx : & ExtendedDecodeContext , doc : ebml:: Doc ) -> def :: Def {
398400 let mut dsr = reader:: Decoder :: new ( doc) ;
399- let def: ast :: Def = Decodable :: decode ( & mut dsr) . unwrap ( ) ;
401+ let def: def :: Def = Decodable :: decode ( & mut dsr) . unwrap ( ) ;
400402 def. tr ( xcx)
401403}
402404
403- impl tr for ast :: Def {
404- fn tr ( & self , xcx : & ExtendedDecodeContext ) -> ast :: Def {
405+ impl tr for def :: Def {
406+ fn tr ( & self , xcx : & ExtendedDecodeContext ) -> def :: Def {
405407 match * self {
406- ast :: DefFn ( did, p) => ast :: DefFn ( did. tr ( xcx) , p) ,
407- ast :: DefStaticMethod ( did, wrapped_did2, p) => {
408- ast :: DefStaticMethod ( did. tr ( xcx) ,
408+ def :: DefFn ( did, p) => def :: DefFn ( did. tr ( xcx) , p) ,
409+ def :: DefStaticMethod ( did, wrapped_did2, p) => {
410+ def :: DefStaticMethod ( did. tr ( xcx) ,
409411 match wrapped_did2 {
410- ast :: FromTrait ( did2) => {
411- ast :: FromTrait ( did2. tr ( xcx) )
412+ def :: FromTrait ( did2) => {
413+ def :: FromTrait ( did2. tr ( xcx) )
412414 }
413- ast :: FromImpl ( did2) => {
414- ast :: FromImpl ( did2. tr ( xcx) )
415+ def :: FromImpl ( did2) => {
416+ def :: FromImpl ( did2. tr ( xcx) )
415417 }
416418 } ,
417419 p)
418420 }
419- ast :: DefMethod ( did0, did1) => {
420- ast :: DefMethod ( did0. tr ( xcx) , did1. map ( |did1| did1. tr ( xcx) ) )
421+ def :: DefMethod ( did0, did1) => {
422+ def :: DefMethod ( did0. tr ( xcx) , did1. map ( |did1| did1. tr ( xcx) ) )
421423 }
422- ast :: DefSelfTy ( nid) => { ast :: DefSelfTy ( xcx. tr_id ( nid) ) }
423- ast :: DefMod ( did) => { ast :: DefMod ( did. tr ( xcx) ) }
424- ast :: DefForeignMod ( did) => { ast :: DefForeignMod ( did. tr ( xcx) ) }
425- ast :: DefStatic ( did, m) => { ast :: DefStatic ( did. tr ( xcx) , m) }
426- ast :: DefArg ( nid, b) => { ast :: DefArg ( xcx. tr_id ( nid) , b) }
427- ast :: DefLocal ( nid, b) => { ast :: DefLocal ( xcx. tr_id ( nid) , b) }
428- ast :: DefVariant ( e_did, v_did, is_s) => {
429- ast :: DefVariant ( e_did. tr ( xcx) , v_did. tr ( xcx) , is_s)
424+ def :: DefSelfTy ( nid) => { def :: DefSelfTy ( xcx. tr_id ( nid) ) }
425+ def :: DefMod ( did) => { def :: DefMod ( did. tr ( xcx) ) }
426+ def :: DefForeignMod ( did) => { def :: DefForeignMod ( did. tr ( xcx) ) }
427+ def :: DefStatic ( did, m) => { def :: DefStatic ( did. tr ( xcx) , m) }
428+ def :: DefArg ( nid, b) => { def :: DefArg ( xcx. tr_id ( nid) , b) }
429+ def :: DefLocal ( nid, b) => { def :: DefLocal ( xcx. tr_id ( nid) , b) }
430+ def :: DefVariant ( e_did, v_did, is_s) => {
431+ def :: DefVariant ( e_did. tr ( xcx) , v_did. tr ( xcx) , is_s)
430432 } ,
431- ast :: DefTrait ( did) => ast :: DefTrait ( did. tr ( xcx) ) ,
432- ast :: DefTy ( did) => ast :: DefTy ( did. tr ( xcx) ) ,
433- ast :: DefPrimTy ( p) => ast :: DefPrimTy ( p) ,
434- ast :: DefTyParam ( did, v) => ast :: DefTyParam ( did. tr ( xcx) , v) ,
435- ast :: DefBinding ( nid, bm) => ast :: DefBinding ( xcx. tr_id ( nid) , bm) ,
436- ast :: DefUse ( did) => ast :: DefUse ( did. tr ( xcx) ) ,
437- ast :: DefUpvar ( nid1, def, nid2, nid3) => {
438- ast :: DefUpvar ( xcx. tr_id ( nid1) ,
433+ def :: DefTrait ( did) => def :: DefTrait ( did. tr ( xcx) ) ,
434+ def :: DefTy ( did) => def :: DefTy ( did. tr ( xcx) ) ,
435+ def :: DefPrimTy ( p) => def :: DefPrimTy ( p) ,
436+ def :: DefTyParam ( did, v) => def :: DefTyParam ( did. tr ( xcx) , v) ,
437+ def :: DefBinding ( nid, bm) => def :: DefBinding ( xcx. tr_id ( nid) , bm) ,
438+ def :: DefUse ( did) => def :: DefUse ( did. tr ( xcx) ) ,
439+ def :: DefUpvar ( nid1, def, nid2, nid3) => {
440+ def :: DefUpvar ( xcx. tr_id ( nid1) ,
439441 @( * def) . tr ( xcx) ,
440442 xcx. tr_id ( nid2) ,
441443 xcx. tr_id ( nid3) )
442444 }
443- ast :: DefStruct ( did) => ast :: DefStruct ( did. tr ( xcx) ) ,
444- ast :: DefRegion ( nid) => ast :: DefRegion ( xcx. tr_id ( nid) ) ,
445- ast :: DefTyParamBinder ( nid) => {
446- ast :: DefTyParamBinder ( xcx. tr_id ( nid) )
445+ def :: DefStruct ( did) => def :: DefStruct ( did. tr ( xcx) ) ,
446+ def :: DefRegion ( nid) => def :: DefRegion ( xcx. tr_id ( nid) ) ,
447+ def :: DefTyParamBinder ( nid) => {
448+ def :: DefTyParamBinder ( xcx. tr_id ( nid) )
447449 }
448- ast :: DefLabel ( nid) => ast :: DefLabel ( xcx. tr_id ( nid) )
450+ def :: DefLabel ( nid) => def :: DefLabel ( xcx. tr_id ( nid) )
449451 }
450452 }
451453}
@@ -796,7 +798,7 @@ trait ebml_writer_helpers {
796798 fn emit_tpbt ( & mut self ,
797799 ecx : & e:: EncodeContext ,
798800 tpbt : ty:: ty_param_bounds_and_ty ) ;
799- fn emit_substs ( & mut self , ecx : & e:: EncodeContext , substs : & ty :: substs ) ;
801+ fn emit_substs ( & mut self , ecx : & e:: EncodeContext , substs : & subst :: Substs ) ;
800802 fn emit_auto_adjustment ( & mut self , ecx : & e:: EncodeContext , adj : & ty:: AutoAdjustment ) ;
801803}
802804
@@ -842,7 +844,7 @@ impl<'a> ebml_writer_helpers for Encoder<'a> {
842844 } ) ;
843845 }
844846
845- fn emit_substs ( & mut self , ecx : & e:: EncodeContext , substs : & ty :: substs ) {
847+ fn emit_substs ( & mut self , ecx : & e:: EncodeContext , substs : & subst :: Substs ) {
846848 self . emit_opaque ( |this| Ok ( tyencode:: enc_substs ( this. writer ,
847849 & ecx. ty_str_ctxt ( ) ,
848850 substs) ) ) ;
@@ -1076,7 +1078,7 @@ trait ebml_decoder_decoder_helpers {
10761078 -> ty:: TypeParameterDef ;
10771079 fn read_ty_param_bounds_and_ty ( & mut self , xcx : & ExtendedDecodeContext )
10781080 -> ty:: ty_param_bounds_and_ty ;
1079- fn read_substs ( & mut self , xcx : & ExtendedDecodeContext ) -> ty :: substs ;
1081+ fn read_substs ( & mut self , xcx : & ExtendedDecodeContext ) -> subst :: Substs ;
10801082 fn read_auto_adjustment ( & mut self , xcx : & ExtendedDecodeContext ) -> ty:: AutoAdjustment ;
10811083 fn convert_def_id ( & mut self ,
10821084 xcx : & ExtendedDecodeContext ,
@@ -1093,7 +1095,7 @@ trait ebml_decoder_decoder_helpers {
10931095 cdata : & cstore:: crate_metadata ) -> Vec < ty:: t > ;
10941096 fn read_substs_noxcx ( & mut self , tcx : & ty:: ctxt ,
10951097 cdata : & cstore:: crate_metadata )
1096- -> ty :: substs ;
1098+ -> subst :: Substs ;
10971099}
10981100
10991101impl < ' a > ebml_decoder_decoder_helpers for reader:: Decoder < ' a > {
@@ -1121,7 +1123,7 @@ impl<'a> ebml_decoder_decoder_helpers for reader::Decoder<'a> {
11211123 fn read_substs_noxcx ( & mut self ,
11221124 tcx : & ty:: ctxt ,
11231125 cdata : & cstore:: crate_metadata )
1124- -> ty :: substs
1126+ -> subst :: Substs
11251127 {
11261128 self . read_opaque ( |_, doc| {
11271129 Ok ( tydecode:: parse_substs_data (
@@ -1210,7 +1212,7 @@ impl<'a> ebml_decoder_decoder_helpers for reader::Decoder<'a> {
12101212 } ) . unwrap ( )
12111213 }
12121214
1213- fn read_substs ( & mut self , xcx : & ExtendedDecodeContext ) -> ty :: substs {
1215+ fn read_substs ( & mut self , xcx : & ExtendedDecodeContext ) -> subst :: Substs {
12141216 self . read_opaque ( |this, doc| {
12151217 Ok ( tydecode:: parse_substs_data ( doc. data ,
12161218 xcx. dcx . cdata . cnum ,
0 commit comments