Repository navigation
stabilize Box::new_uninit_in and Box::new_zeroed_in - #166148
folkertdev wants to merge 1 commit into
Conversation
|
r? @clarfonthey rustbot has assigned @clarfonthey. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
r=me pending FCP: @rfcbot merge libs |
|
@clarfonthey has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/libs-ping: FCP proposed for libs, please feel free to register concerns. |
|
(Removing nomination since this is just more allocator API stabilisations. I think these are fine to merge since we've decided how we want to do this, and while the Box constructor problem is still an issue, we shouldn't delay stabilising these because of that.) |
By this you mean the exponential explosion of method names for each flavor of allocating a |
|
Correct. It's not ideal, but it is what we currently have, and it would be ideal if we could at least make these use cases possible even if the end result is a lot of methods. |
|
Hrrm... and then someone comes and asks for the So can you make an argument why these and not those? |
|
To this question, I point you toward integers and their combinatorical explosion of methods. |
|
But then you're not really arguing "let's add only these", you're arguing for stabilizing these with an argument that generalizes to more methods... which in turn is basically saying we're not going to solve that problem and stabilize most of the methods instead. |
|
Salami-slicing is probably the most German phrase you could have chosen here, but yes, you are right. I think that the Box constructor problem is an issue and I think that, at least for the case of the allocator APIs, we should not solve it. Which is to say, we should be okay adding in extra |
|
Well for the fallible versions there is the current idea of For |
|
The other idea that sometimes floats around for reducing the combinatorial explosion is to have types like |
|
German? I thought salami was an Italian word? If we want to be Deutsch about it we'd say we don't want to chop up this problem any wurst. |
There's rust-lang/wg-allocators#90 which has a rough shape sketched at the end. I think there has been openness to an experiment, just needs somebody to actually do it. |
tracking issue: #163177
Splits out
Box::new_uninit_inandBox::new_zeroed_infromallocator_extand stabilizes them.Public API
These are the custom allocator equivalents of the stable
Box::new_uninitandBox::new_zeroedfunctions.There are equivalent functions for
RcandArc, but there evennew_inis still unstable.There are also the
Box::new_{uninit, zeroed}_slice_inmethods, but I believe those are a bit more controversial because they add another axis of constructor function. We may soon have the equivalentImplementation history
Box#77187Some relevant PRs
feature(new_uninit)#129401new_zeroed_alloc#144091