Skip to content

Commit 540b52e

Browse files
Aatcheddyb
authored andcommitted
Fix recursion depth counting in layout
1 parent d708a40 commit 540b52e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/librustc/ty/util.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,11 +654,12 @@ impl<'a, 'tcx> ty::TyS<'tcx> {
654654
}
655655

656656
tcx.layout_depth.set(depth+1);
657-
let layout = Layout::compute_uncached(self, infcx)?;
657+
let layout = Layout::compute_uncached(self, infcx);
658+
tcx.layout_depth.set(depth);
659+
let layout = layout?;
658660
if can_cache {
659661
tcx.layout_cache.borrow_mut().insert(self, layout);
660662
}
661-
tcx.layout_depth.set(depth);
662663
Ok(layout)
663664
}
664665

0 commit comments

Comments
 (0)