Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upPlacement protocol should allow failure in place creation. #1315
Comments
This comment has been minimized.
This comment has been minimized.
|
(We recently discussed this amongst the lang team.) My standard response is: Why not (Or in the more recent proposed syntax, |
This comment has been minimized.
This comment has been minimized.
|
After we discussed on IRC (to late to bring up, unfortunately!), I realised this was encodable in the manner @pnkfelix said. See "Fallible Placement" for more details and a working example. I'm inclined to close this issue, but maybe it could cover improving the support/smoothing out some of the strangeness. |
This comment has been minimized.
This comment has been minimized.
|
That's the solution I came up with for my |
nrc
added
the
T-lang
label
Aug 19, 2016
bors
added a commit
to rust-lang/rust
that referenced
this issue
Apr 4, 2018
This comment has been minimized.
This comment has been minimized.
|
This is moot now. |
rphmeier commentedOct 10, 2015
The only way to indicate failure in in-place allocation is to have your
InPlaceimplementer return aResultfromfinalize(). However, most failures in in-place allocation will occur when there is insufficient space in thePlacerto make a place. The implementation ofPlacerforExchangeHeapSingletonin std sidesteps this issue by panicking when there isn't sufficient heap space, but that is hardly an acceptable solution for every implementation of in-place allocation.Error handling for in-place allocation could become a little weird if every allocation can fail unexpectedly.