@@ -1234,7 +1234,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1234
1234
}
1235
1235
1236
1236
match binding. kind {
1237
- ConvertedBindingKind :: Equality ( term) => {
1237
+ ConvertedBindingKind :: Equality ( mut term) => {
1238
1238
// "Desugar" a constraint like `T: Iterator<Item = u32>` this to
1239
1239
// the "projection predicate" for:
1240
1240
//
@@ -1245,18 +1245,28 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1245
1245
( hir:: def:: DefKind :: AssocTy , ty:: Term :: Ty ( _) )
1246
1246
| ( hir:: def:: DefKind :: AssocConst , ty:: Term :: Const ( _) ) => ( ) ,
1247
1247
( _, _) => {
1248
- let got = if let ty:: Term :: Ty ( _) = term { "type" } else { "const " } ;
1248
+ let got = if let ty:: Term :: Ty ( _) = term { "type" } else { "constant " } ;
1249
1249
let expected = def_kind. descr ( assoc_item_def_id) ;
1250
1250
tcx. sess
1251
1251
. struct_span_err (
1252
1252
binding. span ,
1253
- & format ! ( "mismatch in bind of {expected}, got {got}" ) ,
1253
+ & format ! ( "expected {expected} bound, found {got}" ) ,
1254
1254
)
1255
1255
. span_note (
1256
1256
tcx. def_span ( assoc_item_def_id) ,
1257
- & format ! ( "{expected} defined here does not match {got} " ) ,
1257
+ & format ! ( "{expected} defined here" ) ,
1258
1258
)
1259
1259
. emit ( ) ;
1260
+ term = match def_kind {
1261
+ hir:: def:: DefKind :: AssocTy => tcx. ty_error ( ) . into ( ) ,
1262
+ hir:: def:: DefKind :: AssocConst => tcx
1263
+ . const_error (
1264
+ tcx. bound_type_of ( assoc_item_def_id)
1265
+ . subst ( tcx, projection_ty. skip_binder ( ) . substs ) ,
1266
+ )
1267
+ . into ( ) ,
1268
+ _ => unreachable ! ( ) ,
1269
+ } ;
1260
1270
}
1261
1271
}
1262
1272
bounds. projection_bounds . push ( (
0 commit comments