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