Placement protocol should allow failure in place creation. · Issue #1315 · rust-lang/rfcs (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@rphmeier

Description

@rphmeier

The only way to indicate failure in in-place allocation is to have your InPlace implementer return a Result from finalize(). However, most failures in in-place allocation will occur when there is insufficient space in the Placer to make a place. The implementation of Placer for ExchangeHeapSingleton in 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.