Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upWhy is Error a Box<ErrorKind>? #202
Comments
|
I can't find the issue where this was changed at the moment. But if I remember correctly is was an optimization because by boxing up the errors less bytes had to be put on the stack for returns. |
|
@Cobrand: we ran performance tests and found that allocating a Box and copying the box around the stack was cheaper than copying the error value around the stack. |
|
It used to be pretty simple to match all possibilities with one Thanks for answering! |
|
You should be able to use a single |
What makes the
Box<_>necessary in thetype Error = Box<ErrorKind>definition? As far as I've seen there is no mention of that either in the doc or in the code, and if I recall well it didn't use to have a Box<_> there.