Repository navigation
Stabilize Vec::repeat{_in} - #166120
Stabilize Vec::repeat{_in}#166120Gelbpunkt wants to merge 1 commit into
Vec::repeat{_in}#166120Conversation
|
r? @ChrisDenton rustbot has assigned @ChrisDenton. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
This seems very premature. As you say, they've only just been added on nightly. Usually we want to allow time for people to use and have experience with methods before proposing stabilisation. |
I've discussed these APIs with Nia and she encouraged me to propose stabilization immediately. We saw no reason to wait because we don't see how we could come to a different conclusion regarding the design of these APIs 6 months from now vs today. |
|
I can't think of any reason to jump the gun here, or for any other stabilization. We're unlikely to find possible changes in 6 months, but we're pretty much giving up any chance of doing so if API addition and stabilization happen within only a few weeks of each other. And we owe it to our users to give some reasonable time to provide feedback, maybe there is something that team members haven't thought of. |
|
To me this falls more in the The name was agreed on in the ACP, the implementation is over a decade old and heavily exercised by Especially There is no particular reason to rush, but I also don't see a reason to wait in this case, and a significant upside in having access to these APIs earlier rather than later. |
Indeed, but I think a question worth asking is whether it should be spelled <[_]>::repeat_in(&self, n: usize, alloc: A)instead, complementing the already-existing #![feature(vec_repeat)]
let v: Vec<_> = <[_]>::repeat(&[1, 2, 3], 2);
let u: Vec<_> = Vec::repeat(&[1, 2, 3], 2);look almost the same, but I feel that the existence of |
Just to quote Nia on Zulip, it appears that the suggestion was not immediately, but within a few releases, and I think that maybe some disconnect happened between the proposal. Note that a release would be 6 weeks, not 6 months, and I agree that we don't need to wait a full 6 months before proposing. My inclination would be to simply close this now and reopen later if we get more feedback (noting that right now, we're still trying to get through FCP backlogs, and should at least get through those before trying to add more), but we could also leave this open and delay FCP. Will defer to FCP folks on what we do here. |
For what it's worth, from the name I also expected this to be akin to the slice |
Public API
Implementation history
These two methods were exposed very recently, but the implementation is quite old and was previously already available via the
vec![elem; n]macro syntax.Vec::repeatandVec::repeat_inlibs-team#912Vec::repeatandVec::repeat_in#164043Notes
The stabilization would be proposed for 1.103, not for 1.102, since the methods only got added in 1.102. But I believe this can be FCP'd already and we can leave the PR open until 1.103.