Fix recursion depth counting in layout

This commit is contained in:
James Miller 2017-02-08 22:23:09 +13:00 committed by Eduard-Mihai Burtescu
parent d708a4072a
commit 540b52e145

View File

@ -654,11 +654,12 @@ impl<'a, 'tcx> ty::TyS<'tcx> {
}
tcx.layout_depth.set(depth+1);
let layout = Layout::compute_uncached(self, infcx)?;
let layout = Layout::compute_uncached(self, infcx);
tcx.layout_depth.set(depth);
let layout = layout?;
if can_cache {
tcx.layout_cache.borrow_mut().insert(self, layout);
}
tcx.layout_depth.set(depth);
Ok(layout)
}