]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_middle/ty/query/plumbing.rs
Prevent stack overflow for deeply recursive code
[rust.git] / src / librustc_middle / ty / query / plumbing.rs
index d6d4335e9388d7bdaf653b2ea0a0f210225f7edd..76e5a65472ebee70009dedc2ceef8f03e39492de 100644 (file)
@@ -68,7 +68,9 @@ fn start_query<R>(
             };
 
             // Use the `ImplicitCtxt` while we execute the query.
-            tls::enter_context(&new_icx, |_| compute(*self))
+            tls::enter_context(&new_icx, |_| {
+                crate::middle::limits::ensure_sufficient_stack(|| compute(*self))
+            })
         })
     }
 }