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 upTracking issue for box_syntax #49733
Comments
pietroalbini
added
the
C-tracking-issue
label
Apr 6, 2018
This comment has been minimized.
This comment has been minimized.
spacekookie
commented
May 14, 2018
|
Do I understand it correctly that the Personally I like the idea of having some syntactic sugar for creating something as common as a box (it does look nice). But obviously it would need to be built on something that works. |
This comment has been minimized.
This comment has been minimized.
|
@spacekookie yes, the big deal for box syntax is placement new. |
This comment has been minimized.
This comment has been minimized.
It doesn't optimize well, and even if it did, you would need some other way around it to avoid blowing up the stack in debug mode. |
This comment has been minimized.
This comment has been minimized.
So this is perhaps a bit of a weird usecase, but it is the only reason I have used The obvious alternative is to use the allocator directly and unsafely construct a Box from it, but that's annoying and ugly. See example here: https://github.com/mark-i-m/os2/blob/2ab9d589a4463bd3133157b5c1a2f9f6735a3432/kernel/process/sched.rs#L76-L83 |
pnkfelix
referenced this issue
Feb 19, 2019
Closed
Box::new() doesn't optimize out stack usage #58570
This comment has been minimized.
This comment has been minimized.
ice1000
commented
Mar 10, 2019
|
In most cases people just want to simplify the |
aidanhs commentedApr 6, 2018
•
edited
This is a tracking issue for the box_syntax feature, the special syntax for creating boxes, e.g.
box 1usize(note: box patterns is separate and is tracked at at #29641)This was previously under the same tracking issues as placement (#22181/#27779) but I didn't want to remove it (yet) due to widespread usage in the compiler (
Box::newis implemented in terms of it) and in the wider ecosystem (unlike<-etc which only had a handful of crates using it).Things to decide:
boxsyntax be phased out?Box::newis inline always, or does that not work?Note: when removing this, be careful not to remove the syntax entirely in order to not cause another case of #50832