]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_trait_selection/traits/error_reporting/suggestions.rs
introduce PredicateAtom
[rust.git] / src / librustc_trait_selection / traits / error_reporting / suggestions.rs
index 0a6fb72ca51eae890af70698ac34d8b50d788cf9..200de47244e4f8d4c367f1badf660d6c7b3d33b5 100644 (file)
@@ -1299,10 +1299,8 @@ fn maybe_note_obligation_cause_for_async_await(
         // the type. The last generator (`outer_generator` below) has information about where the
         // bound was introduced. At least one generator should be present for this diagnostic to be
         // modified.
-        let (mut trait_ref, mut target_ty) = match obligation.predicate.kind() {
-            ty::PredicateKind::Trait(p, _) => {
-                (Some(p.skip_binder().trait_ref), Some(p.skip_binder().self_ty()))
-            }
+        let (mut trait_ref, mut target_ty) = match obligation.predicate.skip_binders() {
+            ty::PredicateAtom::Trait(p, _) => (Some(p.trait_ref), Some(p.self_ty())),
             _ => (None, None),
         };
         let mut generator = None;
@@ -1706,6 +1704,7 @@ fn note_obligation_cause_code<T>(
             | ObligationCauseCode::IntrinsicType
             | ObligationCauseCode::MethodReceiver
             | ObligationCauseCode::ReturnNoExpression
+            | ObligationCauseCode::UnifyReceiver(..)
             | ObligationCauseCode::MiscObligation => {}
             ObligationCauseCode::SliceOrArrayElem => {
                 err.note("slice and array elements must have `Sized` type");