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

Documentation for flush() function of Write trait is incorrect #34999

Closed
qdot opened this issue Jul 23, 2016 · 7 comments
Closed

Documentation for flush() function of Write trait is incorrect #34999

qdot opened this issue Jul 23, 2016 · 7 comments
Labels
C-bug Category: This is a bug. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@qdot
Copy link

qdot commented Jul 23, 2016

The flush() function to the write trait is documented (at https://doc.rust-lang.org/std/io/trait.Write.html) as

fn flush(&mut self) -> Result<()>

However this results in the following error in code:

error: wrong number of type arguments: expected 2, found 1 [E0243]

The return value is expected to be Result<(), std::io::Error>.

@jonas-schievink
Copy link
Contributor

That's a std::io::Result<()>, not std::result::Result<(), ?>

@retep998
Copy link
Member

If you click on the Result it will take you to the page for std::io::Result where you will see that it is defined as type Result<T> = Result<T, Error>;. Therefore not a bug, although it is confusing.

@frewsxcv
Copy link
Member

If we changed the function signature in the source from:

fn write(&mut self, buf: &[u8]) -> Result<usize>;

to:

fn write(&mut self, buf: &[u8]) -> io::Result<usize>;

would it display the io:: prefix in the documentation? In my opinion, I think it would make sense to do this if so.

@frewsxcv
Copy link
Member

fn write(&mut self, buf: &[u8]) -> io::Result<usize>;

I'm actually not sure if this is even possible since this line comes straight from libstd/io/mod.rs.

@sfackler
Copy link
Member

rustdoc does not pay attention to the way items are declared in that way.

@steveklabnik steveklabnik added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jul 25, 2016
@steveklabnik steveklabnik added T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. and removed T-tools labels May 18, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 25, 2017
@steveklabnik
Copy link
Member

Triage: no changes here. Not entirely sure this should be fixed, but it's up to the rustdoc team.

@GuillaumeGomez
Copy link
Member

#42066 is more global so let's close this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

8 participants