]> git.lizzy.rs Git - rust.git/commitdiff
hir typeck: `fulfillment_cx` ignore regions
authorlcnr <rust@lcnr.de>
Fri, 8 Jul 2022 09:17:12 +0000 (11:17 +0200)
committerlcnr <rust@lcnr.de>
Fri, 15 Jul 2022 15:01:32 +0000 (17:01 +0200)
compiler/rustc_trait_selection/src/traits/engine.rs
compiler/rustc_typeck/src/check/inherited.rs

index 6c177f6388704a943548eb824a97e5df6ab2b46d..0f7dc6a1257e5eee318905021a75fa539af7c8c7 100644 (file)
@@ -15,6 +15,8 @@
 
 pub trait TraitEngineExt<'tcx> {
     fn new(tcx: TyCtxt<'tcx>) -> Box<Self>;
+
+    fn new_ignoring_regions(tcx: TyCtxt<'tcx>) -> Box<Self>;
 }
 
 impl<'tcx> TraitEngineExt<'tcx> for dyn TraitEngine<'tcx> {
@@ -25,6 +27,14 @@ fn new(tcx: TyCtxt<'tcx>) -> Box<Self> {
             Box::new(FulfillmentContext::new())
         }
     }
+
+    fn new_ignoring_regions(tcx: TyCtxt<'tcx>) -> Box<Self> {
+        if tcx.sess.opts.unstable_opts.chalk {
+            Box::new(ChalkFulfillmentContext::new())
+        } else {
+            Box::new(FulfillmentContext::new_ignoring_regions())
+        }
+    }
 }
 
 /// Used if you want to have pleasant experience when dealing
index 0889aff3934e693011c5f2dc664692f384f12c89..4afbc00b37c7359f67f89cec973e491e077f0bff 100644 (file)
@@ -113,7 +113,7 @@ fn new(infcx: InferCtxt<'a, 'tcx>, def_id: LocalDefId) -> Self {
                 maybe_typeck_results: infcx.in_progress_typeck_results,
             },
             infcx,
-            fulfillment_cx: RefCell::new(<dyn TraitEngine<'_>>::new(tcx)),
+            fulfillment_cx: RefCell::new(<dyn TraitEngine<'_>>::new_ignoring_regions(tcx)),
             locals: RefCell::new(Default::default()),
             deferred_sized_obligations: RefCell::new(Vec::new()),
             deferred_call_resolutions: RefCell::new(Default::default()),