4 ms·
Unless I'm mistaken, the little-b `box` keyword panics on failure. Isn't that required to construct a type in place in heap memory?
by muricula 9y ago
Unless I'm mistaken, the little-b `box` keyword panics on failure. Isn't that required to construct a type in place in heap memory?
- steveklabnik 9y agoThe box keyword isn't in stable Rust yet, and isn't even "the box keyword" anymore. https://github.com/rust-lang/rfcs/blob/master/text/1228-placement-left-arrow.md https://github.com/rust-lang/rfcs/blob/master/text/1228-plac... is the latest RFC I believe, but even that I believe is changing since the latest allocator API work, though I'm not 100% sure.
- dbaupp 9y agoMy understanding is that the latest RFCes touching that syntax (not sure if they're implemented) have it overloaded with traits, and I would guess/hope that it's possible to implement those traits in a way that is fallible (e.g. hypothetically 'impl BoxSyntax for Result<Box<T>, AllocationError>').