@@ -1234,7 +1234,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
12341234 }
12351235
12361236 match binding. kind {
1237- ConvertedBindingKind :: Equality ( term) => {
1237+ ConvertedBindingKind :: Equality ( mut term) => {
12381238 // "Desugar" a constraint like `T: Iterator<Item = u32>` this to
12391239 // the "projection predicate" for:
12401240 //
@@ -1245,18 +1245,28 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
12451245 ( hir:: def:: DefKind :: AssocTy , ty:: Term :: Ty ( _) )
12461246 | ( hir:: def:: DefKind :: AssocConst , ty:: Term :: Const ( _) ) => ( ) ,
12471247 ( _, _) => {
1248- let got = if let ty:: Term :: Ty ( _) = term { "type" } else { "const " } ;
1248+ let got = if let ty:: Term :: Ty ( _) = term { "type" } else { "constant " } ;
12491249 let expected = def_kind. descr ( assoc_item_def_id) ;
12501250 tcx. sess
12511251 . struct_span_err (
12521252 binding. span ,
1253- & format ! ( "mismatch in bind of {expected}, got {got}" ) ,
1253+ & format ! ( "expected {expected} bound, found {got}" ) ,
12541254 )
12551255 . span_note (
12561256 tcx. def_span ( assoc_item_def_id) ,
1257- & format ! ( "{expected} defined here does not match {got} " ) ,
1257+ & format ! ( "{expected} defined here" ) ,
12581258 )
12591259 . 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+ } ;
12601270 }
12611271 }
12621272 bounds. projection_bounds . push ( (
0 commit comments