1
Fork 0

Auto merge of #112708 - flip1995:clippy-freezing-pc-with-ice, r=oli-obk

Avoid calling queries during query stack printing

This has the side effect, that when Clippy should ICE (during an EarlyPass?) it will fill up the RAM with 2 GB/s and then freezes my Laptop. This is blocking the Clippy sync and might give some people really bad experiences, so this should be merged ASAP.

r? `@cjgillot`
cc `@Zoxc`

I only commented this on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.60try_print_query_stack.60.20has.20.60ImplicitCtx.60.20during.20.60EarlyPass.60/near/363926180). I should've left a comment on the PR as well. My bad.
This commit is contained in:
bors 2023-06-28 09:40:07 +00:00
commit 8882507bc7
5 changed files with 61 additions and 9 deletions

View file

@ -354,7 +354,12 @@ pub fn try_print_query_stack(handler: &Handler, num_frames: Option<usize>) {
// state if it was responsible for triggering the panic.
let i = ty::tls::with_context_opt(|icx| {
if let Some(icx) = icx {
print_query_stack(QueryCtxt::new(icx.tcx), icx.query, handler, num_frames)
ty::print::with_no_queries!(print_query_stack(
QueryCtxt::new(icx.tcx),
icx.query,
handler,
num_frames
))
} else {
0
}