error-chain
error-chain copied to clipboard
Document details around recursion limits
Moving my comment from /r/rust here cause it seemed like the answers are probably useful enough to add to error-chain's docs. :}
Can you provide some more info on the consequences of increasing the program's recursion limit? What is it by default and how was the new value of 1024 chosen? Are there any performance penalties for doing this? If not, why is the default value not high enough to accommodate error-chain? Would it be possible to change error-chain's internals in a way that doesn't require recursion?
You can see the doc for recursion_limit. Here is what happens if you reach the limit: https://play.rust-lang.org/?gist=401dbbf291eef27581479c8fd1d012ab&version=stable&backtrace=1. Depending on the complexity of your error declaration, you may not need to change the default. If the see this error, then you need to add it. There is no performance impact, except that some macro expansion that reached the limit may complete, and that rustc will take longer to detect an infinite recursion.
Does number of error variants in single error_chain! affect the number of recursions that error_chain may do?