11use super :: TypeErrCtxt ;
22use rustc_errors:: Applicability :: { MachineApplicable , MaybeIncorrect } ;
33use rustc_errors:: { pluralize, Diagnostic , MultiSpan } ;
4- use rustc_hir:: { self as hir, def :: DefKind } ;
4+ use rustc_hir as hir;
55use rustc_middle:: traits:: ObligationCauseCode ;
66use rustc_middle:: ty:: error:: ExpectedFound ;
77use rustc_middle:: ty:: print:: Printer ;
@@ -75,7 +75,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
7575 diag. note ( "an associated type was expected, but a different one was found" ) ;
7676 }
7777 ( ty:: Param ( p) , ty:: Alias ( ty:: Projection , proj) ) | ( ty:: Alias ( ty:: Projection , proj) , ty:: Param ( p) )
78- if tcx. def_kind ( proj. def_id ) != DefKind :: ImplTraitPlaceholder =>
78+ if ! tcx. is_impl_trait_in_trait ( proj. def_id ) =>
7979 {
8080 let p_def_id = tcx
8181 . generics_of ( body_owner_def_id)
@@ -222,7 +222,7 @@ impl<T> Trait<T> for X {
222222 diag. span_label ( p_span, "this type parameter" ) ;
223223 }
224224 }
225- ( ty:: Alias ( ty:: Projection , proj_ty) , _) if tcx. def_kind ( proj_ty. def_id ) != DefKind :: ImplTraitPlaceholder => {
225+ ( ty:: Alias ( ty:: Projection , proj_ty) , _) if ! tcx. is_impl_trait_in_trait ( proj_ty. def_id ) => {
226226 self . expected_projection (
227227 diag,
228228 proj_ty,
@@ -231,7 +231,7 @@ impl<T> Trait<T> for X {
231231 cause. code ( ) ,
232232 ) ;
233233 }
234- ( _, ty:: Alias ( ty:: Projection , proj_ty) ) if tcx. def_kind ( proj_ty. def_id ) != DefKind :: ImplTraitPlaceholder => {
234+ ( _, ty:: Alias ( ty:: Projection , proj_ty) ) if ! tcx. is_impl_trait_in_trait ( proj_ty. def_id ) => {
235235 let msg = format ! (
236236 "consider constraining the associated type `{}` to `{}`" ,
237237 values. found, values. expected,
0 commit comments