Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

tmiasko
Copy link
Contributor

@tmiasko tmiasko commented Jul 6, 2020

Previously, when non-empty sequence of empty IoSlices have been provided
to Write::write_all_vectored, the buffers would be written as is with
Write::write_vectored and subsequently the return value Ok(0) would
be misinterpreted as an error.

Avoid writes without any data by advancing the buffers first. This
matches the documented behaviour of Write::write_all_vectored
and is analogous to what happens in Write::write_all.

@rust-highfive
Copy link
Contributor

r? @cramertj

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 6, 2020
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes me happy this is possible now :)

@Muirrum
Copy link
Member

Muirrum commented Jul 24, 2020

@Thomasdezeeuw @tmiasko This is a triage bump.

@Dylan-DPC-zz
Copy link

r? @KodrAus

@JohnTitor JohnTitor assigned KodrAus and unassigned cramertj Jul 24, 2020
@KodrAus
Copy link
Contributor

KodrAus commented Jul 26, 2020

I’m not very familiar with this API, but @tmiasko do you expect this unconditional advance to have any perf impact for the more common case of non-empty buffers?

@tmiasko
Copy link
Contributor Author

tmiasko commented Jul 26, 2020

I would expect the impact to be negligible compared to any I/O involved, and changes necessary regardless of the impact.

Previously, when non-empty sequence of empty IoSlices have been provided
to `Write::write_all_vectored`, the buffers would be written as is with
`Write::write_vectored` and subsequently the return value `Ok(0)` would
be misinterpreted as an error.

Avoid writes without any data by advancing the buffers first. This
matches the documented behaviour of `Write::write_all_vectored`
and is analogous to what happens in `Write::write_all`.
@tmiasko tmiasko force-pushed the write-all-vectored-empty branch from f1bf504 to 7a5d3ab Compare July 26, 2020 10:26
@KodrAus
Copy link
Contributor

KodrAus commented Jul 27, 2020

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jul 27, 2020

📌 Commit 7a5d3ab has been approved by KodrAus

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 27, 2020
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 27, 2020
…=KodrAus

Avoid writes without any data in `Write::write_all_vectored`

Previously, when non-empty sequence of empty IoSlices have been provided
to `Write::write_all_vectored`, the buffers would be written as is with
`Write::write_vectored` and subsequently the return value `Ok(0)` would
be misinterpreted as an error.

Avoid writes without any data by advancing the buffers first. This
matches the documented behaviour of `Write::write_all_vectored`
and is analogous to what happens in `Write::write_all`.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 27, 2020
Rollup of 6 pull requests

Successful merges:

 - rust-lang#74088 (Avoid writes without any data in `Write::write_all_vectored`)
 - rust-lang#74598 (Fix sync_once_cell_does_not_leak_partially_constructed_boxes)
 - rust-lang#74750 (Clean up some uses of logging in ui tests)
 - rust-lang#74783 (python codes cleanup)
 - rust-lang#74790 (Don't italicize comments in ayu theme)
 - rust-lang#74799 (Fixed typo in `closure`)

Failed merges:

r? @ghost
@bors bors merged commit 1361b02 into rust-lang:master Jul 27, 2020
@tmiasko tmiasko deleted the write-all-vectored-empty branch July 27, 2020 15:49
@cuviper cuviper added this to the 1.47.0 milestone May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants