@@ -40,6 +40,7 @@ pub struct At<'a, 'tcx> {
4040 /// matching from matching anything against opaque
4141 /// types.
4242 pub define_opaque_types : bool ,
43+ pub defer_projection_equality : bool ,
4344}
4445
4546pub struct Trace < ' a , ' tcx > {
@@ -55,7 +56,13 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
5556 cause : & ' a ObligationCause < ' tcx > ,
5657 param_env : ty:: ParamEnv < ' tcx > ,
5758 ) -> At < ' a , ' tcx > {
58- At { infcx : self , cause, param_env, define_opaque_types : true }
59+ At {
60+ infcx : self ,
61+ cause,
62+ param_env,
63+ define_opaque_types : true ,
64+ defer_projection_equality : true ,
65+ }
5966 }
6067
6168 /// Forks the inference context, creating a new inference context with the same inference
@@ -101,6 +108,10 @@ impl<'a, 'tcx> At<'a, 'tcx> {
101108 Self { define_opaque_types, ..self }
102109 }
103110
111+ pub fn defer_projection_equality ( self , defer_projection_equality : bool ) -> Self {
112+ Self { defer_projection_equality, ..self }
113+ }
114+
104115 /// Hacky routine for equating two impl headers in coherence.
105116 pub fn eq_impl_headers (
106117 self ,
@@ -252,7 +263,12 @@ impl<'a, 'tcx> Trace<'a, 'tcx> {
252263 {
253264 let Trace { at, trace, a_is_expected } = self ;
254265 at. infcx . commit_if_ok ( |_| {
255- let mut fields = at. infcx . combine_fields ( trace, at. param_env , at. define_opaque_types ) ;
266+ let mut fields = at. infcx . combine_fields (
267+ trace,
268+ at. param_env ,
269+ at. define_opaque_types ,
270+ at. defer_projection_equality ,
271+ ) ;
256272 fields
257273 . sub ( a_is_expected)
258274 . relate ( a, b)
@@ -269,7 +285,12 @@ impl<'a, 'tcx> Trace<'a, 'tcx> {
269285 {
270286 let Trace { at, trace, a_is_expected } = self ;
271287 at. infcx . commit_if_ok ( |_| {
272- let mut fields = at. infcx . combine_fields ( trace, at. param_env , at. define_opaque_types ) ;
288+ let mut fields = at. infcx . combine_fields (
289+ trace,
290+ at. param_env ,
291+ at. define_opaque_types ,
292+ at. defer_projection_equality ,
293+ ) ;
273294 fields
274295 . equate ( a_is_expected)
275296 . relate ( a, b)
@@ -284,7 +305,12 @@ impl<'a, 'tcx> Trace<'a, 'tcx> {
284305 {
285306 let Trace { at, trace, a_is_expected } = self ;
286307 at. infcx . commit_if_ok ( |_| {
287- let mut fields = at. infcx . combine_fields ( trace, at. param_env , at. define_opaque_types ) ;
308+ let mut fields = at. infcx . combine_fields (
309+ trace,
310+ at. param_env ,
311+ at. define_opaque_types ,
312+ at. defer_projection_equality ,
313+ ) ;
288314 fields
289315 . lub ( a_is_expected)
290316 . relate ( a, b)
@@ -299,7 +325,12 @@ impl<'a, 'tcx> Trace<'a, 'tcx> {
299325 {
300326 let Trace { at, trace, a_is_expected } = self ;
301327 at. infcx . commit_if_ok ( |_| {
302- let mut fields = at. infcx . combine_fields ( trace, at. param_env , at. define_opaque_types ) ;
328+ let mut fields = at. infcx . combine_fields (
329+ trace,
330+ at. param_env ,
331+ at. define_opaque_types ,
332+ at. defer_projection_equality ,
333+ ) ;
303334 fields
304335 . glb ( a_is_expected)
305336 . relate ( a, b)
0 commit comments