1
1
use super :: TypeErrCtxt ;
2
2
use rustc_errors:: Applicability :: { MachineApplicable , MaybeIncorrect } ;
3
3
use rustc_errors:: { pluralize, Diagnostic , MultiSpan } ;
4
- use rustc_hir:: { self as hir, def :: DefKind } ;
4
+ use rustc_hir as hir;
5
5
use rustc_middle:: traits:: ObligationCauseCode ;
6
6
use rustc_middle:: ty:: error:: ExpectedFound ;
7
7
use rustc_middle:: ty:: print:: Printer ;
@@ -75,7 +75,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
75
75
diag. note ( "an associated type was expected, but a different one was found" ) ;
76
76
}
77
77
( 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 ) =>
79
79
{
80
80
let p_def_id = tcx
81
81
. generics_of ( body_owner_def_id)
@@ -222,7 +222,7 @@ impl<T> Trait<T> for X {
222
222
diag. span_label ( p_span, "this type parameter" ) ;
223
223
}
224
224
}
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 ) => {
226
226
self . expected_projection (
227
227
diag,
228
228
proj_ty,
@@ -231,7 +231,7 @@ impl<T> Trait<T> for X {
231
231
cause. code ( ) ,
232
232
) ;
233
233
}
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 ) => {
235
235
let msg = format ! (
236
236
"consider constraining the associated type `{}` to `{}`" ,
237
237
values. found, values. expected,
0 commit comments