Uh oh!
There was an error while loading. Please reload this page.
Some de-~[] work in std::io - #13165
Conversation
lilyball
commented
Mar 27, 2014
Would it make sense to introduce a |
alexcrichton
commented
Mar 27, 2014
I grow slightly worried about all of this removal of I'm basically worried about possibly unnecessary churn. @nick29581, do you think that |
lilyball
commented
Mar 27, 2014
@alexcrichton And, of course, if the client does want to be able to push/pop, they'd have to move the |
alexcrichton
commented
Mar 27, 2014
@kballard, that is not true, in a DST world Moving from |
sfackler
commented
Mar 27, 2014
Why would we want to forbid anyone from pushing to a vector returned by |
alexcrichton
commented
Mar 27, 2014
We wouldn't forbid it, DST provides cheap transitions between |
lilyball
commented
Mar 27, 2014
@alexcrichton Ok you're right, I was confused and was thinking that the data was stored inline. But it's stored in a separate allocation, which means it can be moved between In any case, I am not opposed to returning |
olsonjeffery
commented
Mar 27, 2014
@alexcrichton so my issue is that, right now, in my build.. i use That being said, I don't think it's fair (or right) to pretty much put this on users, pending the change of Should users have to wrangle with either 1) warning spam or 2) workarounds/massaging in their code (as I did) in order to continue using |
alexcrichton
commented
Mar 27, 2014
@olsonjeffery, the Again, I don't want us to get ahead of ourselves. I have not heard from anyone implementing DST as to whether removing
Definitely not 1 (it's turned off), and I would very much like to deliberately change
This is what I've been saying about not changing to |
bill-myers
commented
Mar 27, 2014
BTW, it's easy to make DST Removing OTOH to make it efficient it means that you are forced to round up all |
huonw
commented
Mar 27, 2014
I think the transition from current |
alexcrichton
commented
Mar 28, 2014
@huonw, I'm trying to emphasize that no one here is the one implementing DST, so no one knows for sure that we should remove |
thestinger
commented
Mar 28, 2014
I think It's also a significant performance improvement right now, and switching to |
thestinger
commented
Mar 28, 2014
I can understand wanting to avoid the churn and avoiding a backwards compatibility hazard, but I'm not really convinced that |
nrc
commented
Mar 30, 2014
@alexcrichton Sorry for the late reply, been away from work. I was kind of thinking the same thing myself (whether it is necessary to totally kill [T] now). To be honest, I don't know the answer. I haven't got near to that stage in the implementation. Currently I am adding unsized/sized knowledge into the compiler and that is totally unaffected. My guess is that we don't need to, but it might make things a little bit easier. I would be happy to wait and see - that is do nothing for now and only remove ~[T] when/if we know we have to. In general I prefer to move from one solution to another, rather than from one solution to an intermediate encoding to a second solution since I think the risk of missing something is lower. |
huonw
commented
Mar 30, 2014
(Any response to #13165 (comment)? Functions using |
lilyball
commented
Mar 30, 2014
@huonw I agree. I don't see any benefit to converting to |
nrc
commented
Mar 30, 2014
@huonw I hesitate to voice an opinion on library design since I have zero experience there. From the language POV, I would prefer to see [T] used wherever possible (in preference to Vec) because if we provide a nice syntax we should strive to make it the default and avoid the situation where there are non-obvious choices to make (or worse, choices based only on the aesthetic opinions of the user). It seems that the story is [T] if the size is fixed and Vec if the size can change, but then the cases you point out are difficult because one can't know the size-mutability intent ahead of time and we should expose the implementation detail that Vec is used internally to construct the result. We could have two of each method, one returning Vec, one [T], but that seems really bad. Perhaps the ideal situation is that we return [T] and if the caller changes that immediately to Vec then somehow, magically that is free. Not sure how that could work though. Without such magic, returning Vec seems better since it is more general, but then I have the philosophical objection. Sigh. So, that was a long-winded way of saying 'I don't know'. |
huonw
commented
Mar 31, 2014
The way I see it, the only time a Of course the philosophical objects remain. One way to think of this would be flipping it around: if we only had I would think that we wouldn't do that (because makes the function slower, due to needing a shrink-to-fit to return, and penalises those cases when the caller does want to modify it), and that we would only change things to |
thestinger
commented
Mar 31, 2014
@nick29581: If we use lots of |
lilyball
commented
Mar 31, 2014
@thestinger Ideally, once DST lands, nobody will ever use |
huonw
commented
Apr 5, 2014
Can we move forward on this and just land it? If necessary, we can convert back to (I'm keen to put |
sfackler
commented
Apr 5, 2014
Rebased |
alexcrichton
commented
Apr 6, 2014
There's a little more allocation here and there now since from_utf8_owned can't be used with Vec.
`Reader`, `Writer`, `MemReader`, `MemWriter`, and `MultiWriter` now work with `Vec<u8>` instead of `~[u8]`. This does introduce some extra copies since `from_utf8_owned` isn't usable anymore, but I think that can't be helped until `~str`'s representation changes.
Properly handle break resolution inside non-breakable expressions We now diagnose invalid `continue` expressions and properly handle things like `async` blocks which prevent labels from resolving further. Cleaned this up since `label_break_value` is on the way to stabilization in rust (🎉 finally) and we weren't handling breaks for blocks properly yet.
chore: fix some comments fix some comments *Please write a short comment explaining your change (or "none" for internal only changes)* changelog: none
Reader,Writer,MemReader,MemWriter, andMultiWriternow work withVec<u8>instead of~[u8]. This does introduce some extra copies sincefrom_utf8_ownedisn't usable anymore, but I think that can't be helped until~str's representation changes.