@@ -1112,7 +1112,7 @@ fn report_ambiguous_associated_type(tcx: &ty::ctxt,
1112
1112
// any ambiguity.
1113
1113
fn find_bound_for_assoc_item < ' tcx > ( this : & AstConv < ' tcx > ,
1114
1114
ty_param_node_id : ast:: NodeId ,
1115
- ty_param_name : Option < ast:: Name > ,
1115
+ ty_param_name : ast:: Name ,
1116
1116
assoc_name : ast:: Name ,
1117
1117
span : Span )
1118
1118
-> Result < ty:: PolyTraitRef < ' tcx > , ErrorReported >
@@ -1138,21 +1138,11 @@ fn find_bound_for_assoc_item<'tcx>(this: &AstConv<'tcx>,
1138
1138
. filter ( |b| this. trait_defines_associated_type_named ( b. def_id ( ) , assoc_name) )
1139
1139
. collect ( ) ;
1140
1140
1141
- if let Some ( s) = ty_param_name {
1142
- // borrowck doesn't like this any other way
1143
- one_bound_for_assoc_type ( tcx,
1144
- suitable_bounds,
1145
- & token:: get_name ( s) ,
1146
- & token:: get_name ( assoc_name) ,
1147
- span)
1148
- } else {
1149
- one_bound_for_assoc_type ( tcx,
1150
- suitable_bounds,
1151
- "Self" ,
1152
- & token:: get_name ( assoc_name) ,
1153
- span)
1154
-
1155
- }
1141
+ one_bound_for_assoc_type ( tcx,
1142
+ suitable_bounds,
1143
+ & token:: get_name ( ty_param_name) ,
1144
+ & token:: get_name ( assoc_name) ,
1145
+ span)
1156
1146
}
1157
1147
1158
1148
@@ -1251,7 +1241,11 @@ fn associated_path_def_to_ty<'tcx>(this: &AstConv<'tcx>,
1251
1241
}
1252
1242
( & ty:: TyParam ( _) , def:: DefSelfTy ( Some ( trait_did) , None ) ) => {
1253
1243
assert_eq ! ( trait_did. krate, ast:: LOCAL_CRATE ) ;
1254
- match find_bound_for_assoc_item ( this, trait_did. node , None , assoc_name, span) {
1244
+ match find_bound_for_assoc_item ( this,
1245
+ trait_did. node ,
1246
+ token:: special_idents:: type_self. name ,
1247
+ assoc_name,
1248
+ span) {
1255
1249
Ok ( bound) => bound,
1256
1250
Err ( ErrorReported ) => return ( tcx. types . err , ty_path_def) ,
1257
1251
}
@@ -1260,7 +1254,7 @@ fn associated_path_def_to_ty<'tcx>(this: &AstConv<'tcx>,
1260
1254
assert_eq ! ( param_did. krate, ast:: LOCAL_CRATE ) ;
1261
1255
match find_bound_for_assoc_item ( this,
1262
1256
param_did. node ,
1263
- Some ( param_name) ,
1257
+ param_name,
1264
1258
assoc_name,
1265
1259
span) {
1266
1260
Ok ( bound) => bound,
0 commit comments