Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement read_exact for the Read trait #27588

Merged
merged 2 commits into from
Aug 30, 2015
Merged

Conversation

cesarb
Copy link
Contributor

@cesarb cesarb commented Aug 7, 2015

This implements the proposed "read_exact" RFC (rust-lang/rfcs#980).

Tracking issue: #27585

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @huonw (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

///
/// If this function encounters an "end of file" before completely filling
/// the buffer, it returns an error of the kind `ErrorKind::UnexpectedEOF`.
/// The contents of `buf` are undefined in this case.
Copy link
Member

Choose a reason for hiding this comment

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

Might want to say "unspecified" instead of "undefined" here to avoid conflating with undefined behavior.

@alexcrichton
Copy link
Member

Looking good to me, thanks @cesarb! Just one minor nit and I think this is good to go

@huonw
Copy link
Member

huonw commented Aug 10, 2015

r? @alexcrichton

@rust-highfive rust-highfive assigned alexcrichton and unassigned huonw Aug 10, 2015
@alexcrichton
Copy link
Member

Oh oops, sorry for the delay @cesarb! Feel free to ping a PR whenever it's updated as unfortunately github doesn't send out notifications for force-pushes or new commits.

As one final thing, could you squash these commits together? Thanks!

This implements the proposed "read_exact" RFC
(rust-lang/rfcs#980).
@cesarb
Copy link
Contributor Author

cesarb commented Aug 24, 2015

As one final thing, could you squash these commits together?

Done. Do you need me to also rebase this on top of a more recent master?

Feel free to ping a PR whenever it's updated as unfortunately github doesn't send out notifications for force-pushes or new commits.

Sorry, I hadn't noticed that. I'll make sure to write a dummy comment whenever I update a pull request from now on.

@sfackler
Copy link
Member

@bors r=alexcrichton

@bors
Copy link
Contributor

bors commented Aug 24, 2015

📌 Commit ff81920 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Aug 25, 2015

⌛ Testing commit ff81920 with merge 20ffe32...

@bors
Copy link
Contributor

bors commented Aug 25, 2015

💔 Test failed - auto-mac-64-nopt-t

@sfackler
Copy link
Member

Looks like UnexpectedEOF and read_exact need an associated issue:

../src/libstd/io/error.rs:160:5: 160:18 error: non-deprecated unstable items need to point to an issue with `issue = "NNN"`
../src/libstd/io/error.rs:160     UnexpectedEOF,
                                  ^~~~~~~~~~~~~
../src/libstd/io/mod.rs:596:5: 611:6 error: non-deprecated unstable items need to point to an issue with `issue = "NNN"`
../src/libstd/io/mod.rs:596     fn read_exact(&mut self, mut buf: &mut [u8]) -> Result<()> {
../src/libstd/io/mod.rs:597         while !buf.is_empty() {
../src/libstd/io/mod.rs:598             match self.read(buf) {
../src/libstd/io/mod.rs:599                 Ok(0) => break,
../src/libstd/io/mod.rs:600                 Ok(n) => { let tmp = buf; buf = &mut tmp[n..]; }
../src/libstd/io/mod.rs:601                 Err(ref e) if e.kind() == ErrorKind::Interrupted => {}
                            ...
error: aborting due to 2 previous errors

@cesarb
Copy link
Contributor Author

cesarb commented Aug 27, 2015

There seems to be a catch-22 here:

  • This can only be merged if an issue number is added to the unstable declaration;
  • It doesn't make sense to create a stabilization issue for a feature which hasn't even been merged yet.

What should be done to break this deadlock?

@alexcrichton
Copy link
Member

Ah feel free to use the RFC tracking issue, #27585, for the issue number

@cesarb
Copy link
Contributor Author

cesarb commented Aug 29, 2015

I made a commit adding the issue number to the unstable declarations, and it seems to have been accepted by travis-ci.

@alexcrichton
Copy link
Member

@bors: r+ 73e7a72

@bors
Copy link
Contributor

bors commented Aug 29, 2015

⌛ Testing commit 73e7a72 with merge 29da43e...

@bors
Copy link
Contributor

bors commented Aug 30, 2015

💔 Test failed - auto-linux-64-nopt-t

@sfackler
Copy link
Member

@bors retry

@bors
Copy link
Contributor

bors commented Aug 30, 2015

⌛ Testing commit 73e7a72 with merge abe5dd0...

@bors
Copy link
Contributor

bors commented Aug 30, 2015

💔 Test failed - auto-linux-64-nopt-t

@sfackler
Copy link
Member

@bors retry

@bors
Copy link
Contributor

bors commented Aug 30, 2015

⌛ Testing commit 73e7a72 with merge 4bb9023...

bors added a commit that referenced this pull request Aug 30, 2015
This implements the proposed "read_exact" RFC (rust-lang/rfcs#980).

Tracking issue: #27585
@bors bors merged commit 73e7a72 into rust-lang:master Aug 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants