@@ -1272,7 +1272,7 @@ fn associated_path_def_to_ty<'tcx>(this: &AstConv<'tcx, 'tcx>,
1272
1272
// Find the type of the associated item, and the trait where the associated
1273
1273
// item is declared.
1274
1274
let bound = match ( & ty. sty , ty_path_def) {
1275
- ( _, Def :: SelfTy ( Some ( trait_did) , Some ( ( impl_id, _ ) ) ) ) => {
1275
+ ( _, Def :: SelfTy ( Some ( trait_did) , Some ( impl_id) ) ) => {
1276
1276
// `Self` in an impl of a trait - we have a concrete self type and a
1277
1277
// trait reference.
1278
1278
let trait_ref = tcx. impl_trait_ref ( tcx. map . local_def_id ( impl_id) ) . unwrap ( ) ;
@@ -1479,17 +1479,14 @@ fn base_def_to_ty<'tcx>(this: &AstConv<'tcx, 'tcx>,
1479
1479
tcx. prohibit_type_params ( base_segments) ;
1480
1480
tcx. mk_param ( space, index, name)
1481
1481
}
1482
- Def :: SelfTy ( _, Some ( ( _ , self_ty_id ) ) ) => {
1482
+ Def :: SelfTy ( _, Some ( impl_id ) ) => {
1483
1483
// Self in impl (we know the concrete type).
1484
1484
tcx. prohibit_type_params ( base_segments) ;
1485
- if let Some ( & ty) = tcx. ast_ty_to_ty_cache . borrow ( ) . get ( & self_ty_id) {
1486
- if let Some ( free_substs) = this. get_free_substs ( ) {
1487
- ty. subst ( tcx, free_substs)
1488
- } else {
1489
- ty
1490
- }
1485
+ let ty = tcx. node_id_to_type ( impl_id) ;
1486
+ if let Some ( free_substs) = this. get_free_substs ( ) {
1487
+ ty. subst ( tcx, free_substs)
1491
1488
} else {
1492
- span_bug ! ( span , "self type has not been fully resolved" )
1489
+ ty
1493
1490
}
1494
1491
}
1495
1492
Def :: SelfTy ( Some ( _) , None ) => {
@@ -1585,12 +1582,7 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx, 'tcx>,
1585
1582
1586
1583
let tcx = this. tcx ( ) ;
1587
1584
1588
- if let Some ( & ty) = tcx. ast_ty_to_ty_cache . borrow ( ) . get ( & ast_ty. id ) {
1589
- debug ! ( "ast_ty_to_ty: id={:?} ty={:?} (cached)" , ast_ty. id, ty) ;
1590
- return ty;
1591
- }
1592
-
1593
- let typ = match ast_ty. node {
1585
+ match ast_ty. node {
1594
1586
hir:: TyVec ( ref ty) => {
1595
1587
tcx. mk_slice ( ast_ty_to_ty ( this, rscope, & ty) )
1596
1588
}
@@ -1714,11 +1706,7 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx, 'tcx>,
1714
1706
// handled specially and will not descend into this routine.
1715
1707
this. ty_infer ( None , None , None , ast_ty. span )
1716
1708
}
1717
- } ;
1718
-
1719
- debug ! ( "ast_ty_to_ty: id={:?} ty={:?}" , ast_ty. id, typ) ;
1720
- tcx. ast_ty_to_ty_cache . borrow_mut ( ) . insert ( ast_ty. id , typ) ;
1721
- return typ;
1709
+ }
1722
1710
}
1723
1711
1724
1712
pub fn ty_of_arg < ' tcx > ( this : & AstConv < ' tcx , ' tcx > ,
0 commit comments