Skip to content

fix an incorrect assertion in the doc example for std::io::copy #44712

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Sep 23, 2017

Conversation

oconnor663
Copy link
Contributor

I think this wasn't caught by CI because the foo wrapper function was only defined and not called. This seems to be the norm for doc examples that define a foo function. Is that on purpose?

@rust-highfive
Copy link
Contributor

r? @sfackler

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

@@ -40,9 +40,10 @@ use mem;
///
/// io::copy(&mut reader, &mut writer)?;
///
/// assert_eq!(reader, &writer[..]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

reader is an empty slice at this point.

@sfackler
Copy link
Member

It seems a bit weird that we'd be avoiding running this code to me as well.

r? @GuillaumeGomez

@GuillaumeGomez
Copy link
Member

Thanks!

@bors: r+ rollup

@bors
Copy link
Collaborator

bors commented Sep 20, 2017

📌 Commit c9099ff has been approved by GuillaumeGomez

@steveklabnik
Copy link
Member

steveklabnik commented Sep 20, 2017

This seems to be the norm for doc examples that define a foo function. Is that on purpose?

A lot of stuff in io defines a function so that ? can be used. From there, not invoking it is basically the same as a no_run attribute, which is often done since the examples do things like "make network calls" and "manipulate the file system."

That said, this one seems fine to execute.

@aidanhs aidanhs added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Sep 20, 2017
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Sep 21, 2017
fix an incorrect assertion in the doc example for `std::io::copy`

I think this wasn't caught by CI because the `foo` wrapper function was only defined and not called. This seems to be the norm for doc examples that define a `foo` function. Is that on purpose?
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Sep 23, 2017
fix an incorrect assertion in the doc example for `std::io::copy`

I think this wasn't caught by CI because the `foo` wrapper function was only defined and not called. This seems to be the norm for doc examples that define a `foo` function. Is that on purpose?
bors added a commit that referenced this pull request Sep 23, 2017
Rollup of 14 pull requests

- Successful merges: #44554, #44648, #44658, #44712, #44717, #44726, #44745, #44746, #44749, #44759, #44770, #44773, #44776, #44778
- Failed merges:
@bors bors merged commit c9099ff into rust-lang:master Sep 23, 2017
# for free to join this conversation on GitHub. Already have an account? # 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.

7 participants