@@ -1203,7 +1203,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
1203
1203
1204
1204
let code = match obligation. cause . code ( ) {
1205
1205
ObligationCauseCode :: FunctionArg { parent_code, .. } => parent_code,
1206
- c @ ObligationCauseCode :: MiscItem ( _) | c @ ObligationCauseCode :: MiscItemInExpr ( ..) => c,
1206
+ c @ ObligationCauseCode :: WhereClause ( _)
1207
+ | c @ ObligationCauseCode :: WhereClauseInExpr ( ..) => c,
1207
1208
c if matches ! (
1208
1209
span. ctxt( ) . outer_expn_data( ) . kind,
1209
1210
ExpnKind :: Desugaring ( DesugaringKind :: ForLoop )
@@ -1259,8 +1260,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
1259
1260
let mut_ref_self_ty_satisfies_pred = mk_result ( trait_pred_and_mut_ref) ;
1260
1261
1261
1262
let ( ref_inner_ty_satisfies_pred, ref_inner_ty_mut) =
1262
- if let ObligationCauseCode :: MiscItem ( _) | ObligationCauseCode :: MiscItemInExpr ( .. ) =
1263
- obligation. cause . code ( )
1263
+ if let ObligationCauseCode :: WhereClause ( _)
1264
+ | ObligationCauseCode :: WhereClauseInExpr ( .. ) = obligation. cause . code ( )
1264
1265
&& let ty:: Ref ( _, ty, mutability) = old_pred. self_ty ( ) . skip_binder ( ) . kind ( )
1265
1266
{
1266
1267
(
@@ -1400,10 +1401,10 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
1400
1401
1401
1402
if let ObligationCauseCode :: ImplDerived ( cause) = & * code {
1402
1403
try_borrowing ( cause. derived . parent_trait_pred , & [ ] )
1403
- } else if let ObligationCauseCode :: SpannedItem ( _, _)
1404
- | ObligationCauseCode :: MiscItem ( _)
1405
- | ObligationCauseCode :: MiscItemInExpr ( ..)
1406
- | ObligationCauseCode :: SpannedItemInExpr ( ..) = code
1404
+ } else if let ObligationCauseCode :: SpannedWhereClause ( _, _)
1405
+ | ObligationCauseCode :: WhereClause ( _)
1406
+ | ObligationCauseCode :: WhereClauseInExpr ( ..)
1407
+ | ObligationCauseCode :: SpannedWhereClauseInExpr ( ..) = code
1407
1408
{
1408
1409
try_borrowing ( poly_trait_pred, & never_suggest_borrow)
1409
1410
} else {
@@ -2099,10 +2100,10 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
2099
2100
cause : & ObligationCauseCode < ' tcx > ,
2100
2101
err : & mut Diag < ' tcx > ,
2101
2102
) {
2102
- // First, look for an `SpannedItemInExpr `, which means we can get
2103
+ // First, look for an `SpannedWhereClauseInExpr `, which means we can get
2103
2104
// the uninstantiated predicate list of the called function. And check
2104
2105
// that the predicate that we failed to satisfy is a `Fn`-like trait.
2105
- if let ObligationCauseCode :: SpannedItemInExpr ( def_id, _, _, idx) = cause
2106
+ if let ObligationCauseCode :: SpannedWhereClauseInExpr ( def_id, _, _, idx) = cause
2106
2107
&& let predicates = self . tcx . predicates_of ( def_id) . instantiate_identity ( self . tcx )
2107
2108
&& let Some ( pred) = predicates. predicates . get ( * idx)
2108
2109
&& let ty:: ClauseKind :: Trait ( trait_pred) = pred. kind ( ) . skip_binder ( )
@@ -2743,12 +2744,12 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
2743
2744
ObligationCauseCode :: TupleElem => {
2744
2745
err. note ( "only the last element of a tuple may have a dynamically sized type" ) ;
2745
2746
}
2746
- ObligationCauseCode :: MiscItem ( _) | ObligationCauseCode :: MiscItemInExpr ( ..) => {
2747
+ ObligationCauseCode :: WhereClause ( _) | ObligationCauseCode :: WhereClauseInExpr ( ..) => {
2747
2748
// We hold the `DefId` of the item introducing the obligation, but displaying it
2748
2749
// doesn't add user usable information. It always point at an associated item.
2749
2750
}
2750
- ObligationCauseCode :: SpannedItem ( item_def_id, span)
2751
- | ObligationCauseCode :: SpannedItemInExpr ( item_def_id, span, ..) => {
2751
+ ObligationCauseCode :: SpannedWhereClause ( item_def_id, span)
2752
+ | ObligationCauseCode :: SpannedWhereClauseInExpr ( item_def_id, span, ..) => {
2752
2753
let item_name = tcx. def_path_str ( item_def_id) ;
2753
2754
let short_item_name = with_forced_trimmed_paths ! ( tcx. def_path_str( item_def_id) ) ;
2754
2755
let mut multispan = MultiSpan :: from ( span) ;
@@ -3799,7 +3800,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
3799
3800
// to an associated type (as seen from `trait_pred`) in the predicate. Like in
3800
3801
// trait_pred `S: Sum<<Self as Iterator>::Item>` and predicate `i32: Sum<&()>`
3801
3802
let mut type_diffs = vec ! [ ] ;
3802
- if let ObligationCauseCode :: SpannedItemInExpr ( def_id, _, _, idx) = parent_code
3803
+ if let ObligationCauseCode :: SpannedWhereClauseInExpr ( def_id, _, _, idx) = parent_code
3803
3804
&& let Some ( node_args) = typeck_results. node_args_opt ( call_hir_id)
3804
3805
&& let where_clauses =
3805
3806
self . tcx . predicates_of ( def_id) . instantiate ( self . tcx , node_args)
0 commit comments