@@ -52,7 +52,7 @@ impl<'tcx> InferCtxt<'tcx> {
52
52
span : Span ,
53
53
param_env : ty:: ParamEnv < ' tcx > ,
54
54
) -> InferOk < ' tcx , T > {
55
- if !value. has_opaque_types ( ) {
55
+ if !value. has_projections ( ) {
56
56
return InferOk { value, obligations : vec ! [ ] } ;
57
57
}
58
58
let mut obligations = vec ! [ ] ;
@@ -66,8 +66,11 @@ impl<'tcx> InferCtxt<'tcx> {
66
66
lt_op : |lt| lt,
67
67
ct_op : |ct| ct,
68
68
ty_op : |ty| match * ty. kind ( ) {
69
- ty:: Alias ( ty:: Opaque , ty:: AliasTy { def_id, .. } )
70
- if replace_opaque_type ( def_id) =>
69
+ ty:: Alias ( _, ty:: AliasTy { def_id, substs, .. } )
70
+ if matches ! (
71
+ self . tcx. def_kind( def_id) ,
72
+ DefKind :: OpaqueTy | DefKind :: ImplTraitPlaceholder
73
+ ) && replace_opaque_type ( def_id) =>
71
74
{
72
75
let def_span = self . tcx . def_span ( def_id) ;
73
76
let span = if span. contains ( def_span) { def_span } else { span } ;
@@ -81,9 +84,15 @@ impl<'tcx> InferCtxt<'tcx> {
81
84
span,
82
85
} ) ;
83
86
obligations. extend (
84
- self . handle_opaque_type ( ty, ty_var, true , & cause, param_env)
85
- . unwrap ( )
86
- . obligations ,
87
+ self . handle_opaque_type (
88
+ self . tcx . mk_opaque ( def_id, substs) ,
89
+ ty_var,
90
+ true ,
91
+ & cause,
92
+ param_env,
93
+ )
94
+ . unwrap ( )
95
+ . obligations ,
87
96
) ;
88
97
ty_var
89
98
}
0 commit comments