@@ -16,13 +16,15 @@ use c = metadata::common;
16
16
use cstore = metadata:: cstore;
17
17
use driver:: session:: Session ;
18
18
use metadata:: decoder;
19
+ use middle:: def;
19
20
use e = metadata:: encoder;
20
21
use middle:: freevars:: freevar_entry;
21
22
use middle:: region;
22
23
use metadata:: tydecode;
23
24
use metadata:: tydecode:: { DefIdSource , NominalType , TypeWithId , TypeParameter ,
24
25
RegionParameter } ;
25
26
use metadata:: tyencode;
27
+ use middle:: subst;
26
28
use middle:: typeck:: { MethodCall , MethodCallee , MethodOrigin } ;
27
29
use middle:: { ty, typeck} ;
28
30
use util:: ppaux:: ty_to_str;
@@ -394,58 +396,58 @@ fn renumber_and_map_ast(xcx: &ExtendedDecodeContext,
394
396
// ______________________________________________________________________
395
397
// Encoding and decoding of ast::def
396
398
397
- fn decode_def ( xcx : & ExtendedDecodeContext , doc : ebml:: Doc ) -> ast :: Def {
399
+ fn decode_def ( xcx : & ExtendedDecodeContext , doc : ebml:: Doc ) -> def :: Def {
398
400
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 ( ) ;
400
402
def. tr ( xcx)
401
403
}
402
404
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 {
405
407
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) ,
409
411
match wrapped_did2 {
410
- ast :: FromTrait ( did2) => {
411
- ast :: FromTrait ( did2. tr ( xcx) )
412
+ def :: FromTrait ( did2) => {
413
+ def :: FromTrait ( did2. tr ( xcx) )
412
414
}
413
- ast :: FromImpl ( did2) => {
414
- ast :: FromImpl ( did2. tr ( xcx) )
415
+ def :: FromImpl ( did2) => {
416
+ def :: FromImpl ( did2. tr ( xcx) )
415
417
}
416
418
} ,
417
419
p)
418
420
}
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) ) )
421
423
}
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)
430
432
} ,
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) ,
439
441
@( * def) . tr ( xcx) ,
440
442
xcx. tr_id ( nid2) ,
441
443
xcx. tr_id ( nid3) )
442
444
}
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) )
447
449
}
448
- ast :: DefLabel ( nid) => ast :: DefLabel ( xcx. tr_id ( nid) )
450
+ def :: DefLabel ( nid) => def :: DefLabel ( xcx. tr_id ( nid) )
449
451
}
450
452
}
451
453
}
@@ -796,7 +798,7 @@ trait ebml_writer_helpers {
796
798
fn emit_tpbt ( & mut self ,
797
799
ecx : & e:: EncodeContext ,
798
800
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 ) ;
800
802
fn emit_auto_adjustment ( & mut self , ecx : & e:: EncodeContext , adj : & ty:: AutoAdjustment ) ;
801
803
}
802
804
@@ -842,7 +844,7 @@ impl<'a> ebml_writer_helpers for Encoder<'a> {
842
844
} ) ;
843
845
}
844
846
845
- fn emit_substs ( & mut self , ecx : & e:: EncodeContext , substs : & ty :: substs ) {
847
+ fn emit_substs ( & mut self , ecx : & e:: EncodeContext , substs : & subst :: Substs ) {
846
848
self . emit_opaque ( |this| Ok ( tyencode:: enc_substs ( this. writer ,
847
849
& ecx. ty_str_ctxt ( ) ,
848
850
substs) ) ) ;
@@ -1076,7 +1078,7 @@ trait ebml_decoder_decoder_helpers {
1076
1078
-> ty:: TypeParameterDef ;
1077
1079
fn read_ty_param_bounds_and_ty ( & mut self , xcx : & ExtendedDecodeContext )
1078
1080
-> 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 ;
1080
1082
fn read_auto_adjustment ( & mut self , xcx : & ExtendedDecodeContext ) -> ty:: AutoAdjustment ;
1081
1083
fn convert_def_id ( & mut self ,
1082
1084
xcx : & ExtendedDecodeContext ,
@@ -1093,7 +1095,7 @@ trait ebml_decoder_decoder_helpers {
1093
1095
cdata : & cstore:: crate_metadata ) -> Vec < ty:: t > ;
1094
1096
fn read_substs_noxcx ( & mut self , tcx : & ty:: ctxt ,
1095
1097
cdata : & cstore:: crate_metadata )
1096
- -> ty :: substs ;
1098
+ -> subst :: Substs ;
1097
1099
}
1098
1100
1099
1101
impl < ' a > ebml_decoder_decoder_helpers for reader:: Decoder < ' a > {
@@ -1121,7 +1123,7 @@ impl<'a> ebml_decoder_decoder_helpers for reader::Decoder<'a> {
1121
1123
fn read_substs_noxcx ( & mut self ,
1122
1124
tcx : & ty:: ctxt ,
1123
1125
cdata : & cstore:: crate_metadata )
1124
- -> ty :: substs
1126
+ -> subst :: Substs
1125
1127
{
1126
1128
self . read_opaque ( |_, doc| {
1127
1129
Ok ( tydecode:: parse_substs_data (
@@ -1210,7 +1212,7 @@ impl<'a> ebml_decoder_decoder_helpers for reader::Decoder<'a> {
1210
1212
} ) . unwrap ( )
1211
1213
}
1212
1214
1213
- fn read_substs ( & mut self , xcx : & ExtendedDecodeContext ) -> ty :: substs {
1215
+ fn read_substs ( & mut self , xcx : & ExtendedDecodeContext ) -> subst :: Substs {
1214
1216
self . read_opaque ( |this, doc| {
1215
1217
Ok ( tydecode:: parse_substs_data ( doc. data ,
1216
1218
xcx. dcx . cdata . cnum ,
0 commit comments