Auto merge of #1908 - alexcrichton:moar-stack, r=huonw
authorbors <bors@rust-lang.org>
Mon, 17 Aug 2015 16:22:35 +0000 (16:22 +0000)
committerbors <bors@rust-lang.org>
Mon, 17 Aug 2015 16:22:35 +0000 (16:22 +0000)
There have been a number of reports of Cargo triggering a stack overflow in the
algorithm implemented in `cargo::core::resolve`, and although many attempts have
been made to reduce the stack space of the two relevant recursive functions it
seems likely that this will not always be enough. For now, before moving the
recursion to the heap manually, spawn the main thread with a large stack (e.g.
mirror what the compiler does) to ensure that the same scenarios happen across
platforms at least.

Currently on my machine I get a 2MB stack on Linux and a 512K stack on OSX, so
bumping this up to 8MB should be more than enough for the recursion in this
algorithm. I also hope that with nonzeroing drop a few of the recursive calls
will be able to become tail recursive, which should also help with stack space!

Closes #1897


Trivial merge