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

Error message about importing traits should use a working code #31864

Closed
julienw opened this issue Feb 24, 2016 · 0 comments
Closed

Error message about importing traits should use a working code #31864

julienw opened this issue Feb 24, 2016 · 0 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@julienw
Copy link

julienw commented Feb 24, 2016

Current error when using io::stdout().flush() without importing std::io::Write looks like this:

src/main.rs:95:22: 95:27 error: no method named `flush` found for type `std::io::stdio::Stdout` in the current scope
src/main.rs:95         io::stdout().flush(); // https://github.com/rust-lang/rust/issues/23818
                                    ^~~~~
src/main.rs:95:22: 95:27 help: items from traits can only be used if the trait is in scope; the following trait is implemented but not in scope, perhaps add a `use` for it:
src/main.rs:95:22: 95:27 help: candidate #1: use `std::io::Write`

I think the last line should not have the backticks so that we could use the command directly in code.

@steveklabnik steveklabnik added the A-diagnostics Area: Messages for errors, warnings, and lints label Feb 24, 2016
Manishearth added a commit to Manishearth/rust that referenced this issue Feb 26, 2016
suggest: Put the `use` in suggested code inside the quotes

Change import a trait suggestion from:

       help: candidate #1: use `std::io::Write`

to

       help: candidate #1: `use std::io::Write`

so that the code can be copied directly.

Fixes rust-lang#31864
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

2 participants