@@ -73,6 +73,11 @@ pub trait AstConv<'tcx> {
73
73
fn tcx < ' a > ( & ' a self ) -> & ' a ty:: ctxt < ' tcx > ;
74
74
fn get_item_ty ( & self , id : ast:: DefId ) -> ty:: Polytype < ' tcx > ;
75
75
fn get_trait_def ( & self , id : ast:: DefId ) -> Rc < ty:: TraitDef < ' tcx > > ;
76
+
77
+ /// Return an (optional) substitution to convert bound type parameters that
78
+ /// are in scope into free ones. This function should only return Some
79
+ /// within a fn body.
80
+ /// See ParameterEnvironment::free_substs for more information.
76
81
fn get_free_substs ( & self ) -> Option < & Substs < ' tcx > > {
77
82
None
78
83
}
@@ -1029,21 +1034,15 @@ pub fn ast_ty_to_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
1029
1034
// FIXME(#19541): in both branches we should consider
1030
1035
// associated types in super-traits.
1031
1036
let ( assoc_tys, tp_name) : ( Vec < _ > , _ ) = match typ {
1032
- def:: TyParamProvenance :: FromParam ( did) => {
1037
+ def:: TyParamProvenance :: FromParam ( did) |
1038
+ def:: TyParamProvenance :: FromSelf ( did) => {
1033
1039
let ty_param_defs = tcx. ty_param_defs . borrow ( ) ;
1034
1040
let tp_def = & ( * ty_param_defs) [ did. node ] ;
1035
1041
let assoc_tys = tp_def. bounds . trait_bounds . iter ( )
1036
1042
. filter_map ( |b| find_assoc_ty ( this, & * * b, assoc_ident) )
1037
1043
. collect ( ) ;
1038
1044
( assoc_tys, token:: get_name ( tp_def. name ) . to_string ( ) )
1039
1045
}
1040
- def:: TyParamProvenance :: FromSelf ( did) => {
1041
- let assoc_tys = find_assoc_ty ( this,
1042
- & * this. get_trait_def ( did) . trait_ref ,
1043
- assoc_ident)
1044
- . into_iter ( ) . collect ( ) ;
1045
- ( assoc_tys, "Self" . to_string ( ) )
1046
- }
1047
1046
} ;
1048
1047
1049
1048
if assoc_tys. len ( ) == 0 {
0 commit comments