[parallel-queries] Refactor layout-depth tracking so it does not need mutable state in the GlobalCtxt (original) (raw)

As described here, checking for too deep recursion when computing data layouts should not need to rely on mutable state in the GlobalCtxt.

@Zoxc has implemented one possible solution here: cb51381

Maybe there is an even simpler one that does not require explicitly entering a new tcx.

cc @eddyb & @nikomatsakis