@@ -27,7 +27,8 @@ use metadata::tydecode;
27
27
use metadata:: tydecode:: { DefIdSource , NominalType , TypeWithId } ;
28
28
use metadata:: tydecode:: { RegionParameter , ClosureSource } ;
29
29
use metadata:: tyencode;
30
- use middle:: cast;
30
+ use middle:: ty:: adjustment;
31
+ use middle:: ty:: cast;
31
32
use middle:: check_const:: ConstQualif ;
32
33
use middle:: def;
33
34
use middle:: def_id:: { DefId , LOCAL_CRATE } ;
@@ -646,11 +647,11 @@ trait rbml_writer_helpers<'tcx> {
646
647
fn emit_builtin_bounds ( & mut self , ecx : & e:: EncodeContext , bounds : & ty:: BuiltinBounds ) ;
647
648
fn emit_upvar_capture ( & mut self , ecx : & e:: EncodeContext , capture : & ty:: UpvarCapture ) ;
648
649
fn emit_auto_adjustment < ' a > ( & mut self , ecx : & e:: EncodeContext < ' a , ' tcx > ,
649
- adj : & ty :: AutoAdjustment < ' tcx > ) ;
650
+ adj : & adjustment :: AutoAdjustment < ' tcx > ) ;
650
651
fn emit_autoref < ' a > ( & mut self , ecx : & e:: EncodeContext < ' a , ' tcx > ,
651
- autoref : & ty :: AutoRef < ' tcx > ) ;
652
+ autoref : & adjustment :: AutoRef < ' tcx > ) ;
652
653
fn emit_auto_deref_ref < ' a > ( & mut self , ecx : & e:: EncodeContext < ' a , ' tcx > ,
653
- auto_deref_ref : & ty :: AutoDerefRef < ' tcx > ) ;
654
+ auto_deref_ref : & adjustment :: AutoDerefRef < ' tcx > ) ;
654
655
}
655
656
656
657
impl < ' a , ' tcx > rbml_writer_helpers < ' tcx > for Encoder < ' a > {
@@ -771,22 +772,22 @@ impl<'a, 'tcx> rbml_writer_helpers<'tcx> for Encoder<'a> {
771
772
}
772
773
773
774
fn emit_auto_adjustment < ' b > ( & mut self , ecx : & e:: EncodeContext < ' b , ' tcx > ,
774
- adj : & ty :: AutoAdjustment < ' tcx > ) {
775
+ adj : & adjustment :: AutoAdjustment < ' tcx > ) {
775
776
use serialize:: Encoder ;
776
777
777
778
self . emit_enum ( "AutoAdjustment" , |this| {
778
779
match * adj {
779
- ty :: AdjustReifyFnPointer => {
780
+ adjustment :: AdjustReifyFnPointer => {
780
781
this. emit_enum_variant ( "AdjustReifyFnPointer" , 1 , 0 , |_| Ok ( ( ) ) )
781
782
}
782
783
783
- ty :: AdjustUnsafeFnPointer => {
784
+ adjustment :: AdjustUnsafeFnPointer => {
784
785
this. emit_enum_variant ( "AdjustUnsafeFnPointer" , 2 , 0 , |_| {
785
786
Ok ( ( ) )
786
787
} )
787
788
}
788
789
789
- ty :: AdjustDerefRef ( ref auto_deref_ref) => {
790
+ adjustment :: AdjustDerefRef ( ref auto_deref_ref) => {
790
791
this. emit_enum_variant ( "AdjustDerefRef" , 3 , 2 , |this| {
791
792
this. emit_enum_variant_arg ( 0 ,
792
793
|this| Ok ( this. emit_auto_deref_ref ( ecx, auto_deref_ref) ) )
@@ -797,19 +798,19 @@ impl<'a, 'tcx> rbml_writer_helpers<'tcx> for Encoder<'a> {
797
798
}
798
799
799
800
fn emit_autoref < ' b > ( & mut self , ecx : & e:: EncodeContext < ' b , ' tcx > ,
800
- autoref : & ty :: AutoRef < ' tcx > ) {
801
+ autoref : & adjustment :: AutoRef < ' tcx > ) {
801
802
use serialize:: Encoder ;
802
803
803
804
self . emit_enum ( "AutoRef" , |this| {
804
805
match autoref {
805
- & ty :: AutoPtr ( r, m) => {
806
+ & adjustment :: AutoPtr ( r, m) => {
806
807
this. emit_enum_variant ( "AutoPtr" , 0 , 2 , |this| {
807
808
this. emit_enum_variant_arg ( 0 ,
808
809
|this| Ok ( this. emit_region ( ecx, * r) ) ) ;
809
810
this. emit_enum_variant_arg ( 1 , |this| m. encode ( this) )
810
811
} )
811
812
}
812
- & ty :: AutoUnsafe ( m) => {
813
+ & adjustment :: AutoUnsafe ( m) => {
813
814
this. emit_enum_variant ( "AutoUnsafe" , 1 , 1 , |this| {
814
815
this. emit_enum_variant_arg ( 0 , |this| m. encode ( this) )
815
816
} )
@@ -819,7 +820,7 @@ impl<'a, 'tcx> rbml_writer_helpers<'tcx> for Encoder<'a> {
819
820
}
820
821
821
822
fn emit_auto_deref_ref < ' b > ( & mut self , ecx : & e:: EncodeContext < ' b , ' tcx > ,
822
- auto_deref_ref : & ty :: AutoDerefRef < ' tcx > ) {
823
+ auto_deref_ref : & adjustment :: AutoDerefRef < ' tcx > ) {
823
824
use serialize:: Encoder ;
824
825
825
826
self . emit_struct ( "AutoDerefRef" , 2 , |this| {
@@ -974,7 +975,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
974
975
975
976
if let Some ( adjustment) = tcx. tables . borrow ( ) . adjustments . get ( & id) {
976
977
match * adjustment {
977
- ty :: AdjustDerefRef ( ref adj) => {
978
+ adjustment :: AdjustDerefRef ( ref adj) => {
978
979
for autoderef in 0 ..adj. autoderefs {
979
980
let method_call = ty:: MethodCall :: autoderef ( id, autoderef as u32 ) ;
980
981
if let Some ( method) = tcx. tables . borrow ( ) . method_map . get ( & method_call) {
@@ -1063,17 +1064,17 @@ trait rbml_decoder_decoder_helpers<'tcx> {
1063
1064
fn read_upvar_capture ( & mut self , dcx : & DecodeContext )
1064
1065
-> ty:: UpvarCapture ;
1065
1066
fn read_auto_adjustment < ' a , ' b > ( & mut self , dcx : & DecodeContext < ' a , ' b , ' tcx > )
1066
- -> ty :: AutoAdjustment < ' tcx > ;
1067
+ -> adjustment :: AutoAdjustment < ' tcx > ;
1067
1068
fn read_cast_kind < ' a , ' b > ( & mut self , dcx : & DecodeContext < ' a , ' b , ' tcx > )
1068
1069
-> cast:: CastKind ;
1069
1070
fn read_closure_kind < ' a , ' b > ( & mut self , dcx : & DecodeContext < ' a , ' b , ' tcx > )
1070
1071
-> ty:: ClosureKind ;
1071
1072
fn read_closure_ty < ' a , ' b > ( & mut self , dcx : & DecodeContext < ' a , ' b , ' tcx > )
1072
1073
-> ty:: ClosureTy < ' tcx > ;
1073
1074
fn read_auto_deref_ref < ' a , ' b > ( & mut self , dcx : & DecodeContext < ' a , ' b , ' tcx > )
1074
- -> ty :: AutoDerefRef < ' tcx > ;
1075
+ -> adjustment :: AutoDerefRef < ' tcx > ;
1075
1076
fn read_autoref < ' a , ' b > ( & mut self , dcx : & DecodeContext < ' a , ' b , ' tcx > )
1076
- -> ty :: AutoRef < ' tcx > ;
1077
+ -> adjustment :: AutoRef < ' tcx > ;
1077
1078
fn convert_def_id ( & mut self ,
1078
1079
dcx : & DecodeContext ,
1079
1080
source : DefIdSource ,
@@ -1246,30 +1247,30 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
1246
1247
} ) . unwrap ( )
1247
1248
}
1248
1249
fn read_auto_adjustment < ' b , ' c > ( & mut self , dcx : & DecodeContext < ' b , ' c , ' tcx > )
1249
- -> ty :: AutoAdjustment < ' tcx > {
1250
+ -> adjustment :: AutoAdjustment < ' tcx > {
1250
1251
self . read_enum ( "AutoAdjustment" , |this| {
1251
1252
let variants = [ "AdjustReifyFnPointer" , "AdjustUnsafeFnPointer" , "AdjustDerefRef" ] ;
1252
1253
this. read_enum_variant ( & variants, |this, i| {
1253
1254
Ok ( match i {
1254
- 1 => ty :: AdjustReifyFnPointer ,
1255
- 2 => ty :: AdjustUnsafeFnPointer ,
1255
+ 1 => adjustment :: AdjustReifyFnPointer ,
1256
+ 2 => adjustment :: AdjustUnsafeFnPointer ,
1256
1257
3 => {
1257
- let auto_deref_ref: ty :: AutoDerefRef =
1258
+ let auto_deref_ref: adjustment :: AutoDerefRef =
1258
1259
this. read_enum_variant_arg ( 0 ,
1259
1260
|this| Ok ( this. read_auto_deref_ref ( dcx) ) ) . unwrap ( ) ;
1260
1261
1261
- ty :: AdjustDerefRef ( auto_deref_ref)
1262
+ adjustment :: AdjustDerefRef ( auto_deref_ref)
1262
1263
}
1263
- _ => panic ! ( "bad enum variant for ty ::AutoAdjustment" )
1264
+ _ => panic ! ( "bad enum variant for adjustment ::AutoAdjustment" )
1264
1265
} )
1265
1266
} )
1266
1267
} ) . unwrap ( )
1267
1268
}
1268
1269
1269
1270
fn read_auto_deref_ref < ' b , ' c > ( & mut self , dcx : & DecodeContext < ' b , ' c , ' tcx > )
1270
- -> ty :: AutoDerefRef < ' tcx > {
1271
+ -> adjustment :: AutoDerefRef < ' tcx > {
1271
1272
self . read_struct ( "AutoDerefRef" , 2 , |this| {
1272
- Ok ( ty :: AutoDerefRef {
1273
+ Ok ( adjustment :: AutoDerefRef {
1273
1274
autoderefs : this. read_struct_field ( "autoderefs" , 0 , |this| {
1274
1275
Decodable :: decode ( this)
1275
1276
} ) . unwrap ( ) ,
@@ -1296,7 +1297,7 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
1296
1297
}
1297
1298
1298
1299
fn read_autoref < ' b , ' c > ( & mut self , dcx : & DecodeContext < ' b , ' c , ' tcx > )
1299
- -> ty :: AutoRef < ' tcx > {
1300
+ -> adjustment :: AutoRef < ' tcx > {
1300
1301
self . read_enum ( "AutoRef" , |this| {
1301
1302
let variants = [ "AutoPtr" , "AutoUnsafe" ] ;
1302
1303
this. read_enum_variant ( & variants, |this, i| {
@@ -1311,15 +1312,15 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
1311
1312
Decodable :: decode ( this)
1312
1313
} ) . unwrap ( ) ;
1313
1314
1314
- ty :: AutoPtr ( dcx. tcx . mk_region ( r) , m)
1315
+ adjustment :: AutoPtr ( dcx. tcx . mk_region ( r) , m)
1315
1316
}
1316
1317
1 => {
1317
1318
let m: hir:: Mutability =
1318
1319
this. read_enum_variant_arg ( 0 , |this| Decodable :: decode ( this) ) . unwrap ( ) ;
1319
1320
1320
- ty :: AutoUnsafe ( m)
1321
+ adjustment :: AutoUnsafe ( m)
1321
1322
}
1322
- _ => panic ! ( "bad enum variant for ty ::AutoRef" )
1323
+ _ => panic ! ( "bad enum variant for adjustment ::AutoRef" )
1323
1324
} )
1324
1325
} )
1325
1326
} ) . unwrap ( )
@@ -1467,7 +1468,8 @@ fn decode_side_tables(dcx: &DecodeContext,
1467
1468
dcx. tcx . tables . borrow_mut ( ) . method_map . insert ( method_call, method) ;
1468
1469
}
1469
1470
c:: tag_table_adjustments => {
1470
- let adj: ty:: AutoAdjustment = val_dsr. read_auto_adjustment ( dcx) ;
1471
+ let adj =
1472
+ val_dsr. read_auto_adjustment ( dcx) ;
1471
1473
dcx. tcx . tables . borrow_mut ( ) . adjustments . insert ( id, adj) ;
1472
1474
}
1473
1475
c:: tag_table_closure_tys => {
0 commit comments