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

Compiler suggests to import private trait #57780

Closed
In-line opened this issue Jan 20, 2019 · 4 comments
Closed

Compiler suggests to import private trait #57780

In-line opened this issue Jan 20, 2019 · 4 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-resolve Area: Name/path resolution done by `rustc_resolve` specifically A-trait-system Area: Trait system

Comments

@In-line
Copy link
Contributor

In-line commented Jan 20, 2019

cargo test --color=always --no-run
   Compiling grip-rust v0.0.4-alpha (/home/alik/CLionProjects/grip/rust)
error[E0603]: module `future` is private
  --> src/networking_queue/mod.rs:46:18
   |
46 | use tokio::util::future::FutureExt;
   |                  ^^^^^^

warning: unused import: `tokio::util::future::FutureExt`
  --> src/networking_queue/mod.rs:46:5
   |
46 | use tokio::util::future::FutureExt;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: #[warn(unused_imports)] on by default

error[E0599]: no method named `timeout` found for type `futures::Map<futures::MapErr<futures::future::Select2<futures::OrElse<futures::Map<futures::AndThen<hyper::client::ResponseFuture, futures::stream::Concat2<hyper::Body>, [closure@src/networking_queue/mod.rs:175:59: 175:95]>, [closure@src/networking_queue/mod.rs:177:54: 180:50 request:_]>, futures::FutureResult<networking_queue::Queue::new::{{closure}}::{{closure}}::{{closure}}::State, ()>, [closure@src/networking_queue/mod.rs:181:58: 183:50]>, futures::OrElse<futures::Map<futures::Receiver<()>, [closure@src/networking_queue/mod.rs:185:58: 185:77]>, futures::FutureResult<networking_queue::Queue::new::{{closure}}::{{closure}}::{{closure}}::State, ()>, [closure@src/networking_queue/mod.rs:186:62: 186:93]>>, [closure@src/networking_queue/mod.rs:188:58: 188:110]>, [closure@src/networking_queue/mod.rs:189:54: 191:50]>` in the current scope
   --> src/networking_queue/mod.rs:192:50
    |
192 |                                                 .timeout(Duration::from_millis(1))
    |                                                  ^^^^^^^
    |
    = help: items from traits can only be used if the trait is in scope
    = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
            `use tokio::util::future::FutureExt;`

error: aborting due to 2 previous errors

Some errors occurred: E0599, E0603.
For more information about an error, try `rustc --explain E0599`.
error: Could not compile `grip-rust`.

To learn more, run the command again with --verbose.

Process finished with exit code 101

Version

❯ rustc --version
rustc 1.32.0 (9fda7c223 2019-01-16)

I'm not sure if code really matters (because error message is self-explanatory), but you can get it here

  1. Compiler suggests to import private trait
  2. Compiler complains that trait is unused, but well.. It is trait which can't be imported in the first place.
@In-line In-line changed the title Poor quality errors/suggestions. Poor quality warnings/suggestions. Jan 20, 2019
@In-line
Copy link
Contributor Author

In-line commented Jan 20, 2019

It is fine to get such errors in C++, but not in this language of the gods, so I'm expecting 2 things.

  1. Proper compiler suggestion to import trait, which is reexported somewhere else (In this case use tokio::prelude::FutureExt;)
  2. Compiler should not warn about unused import, which can't be imported

@Centril Centril added A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-diagnostics Area: Messages for errors, warnings, and lints A-resolve Area: Name/path resolution done by `rustc_resolve` specifically A-trait-system Area: Trait system labels Jan 20, 2019
@leonardo-m
Copy link

"language of the gods" seems a bit excessive, but thank you.

@tmandry
Copy link
Member

tmandry commented Mar 26, 2019

Point 2 is being tracked in #48244. Since the title of this issue is broad, you may want to rename it to focus on your first point.

@estebank estebank changed the title Poor quality warnings/suggestions. Compiler suggests to import private trait Apr 23, 2019
@estebank
Copy link
Contributor

Closing in favor of more targeted #26454. The second point has already been fixed.

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 A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-resolve Area: Name/path resolution done by `rustc_resolve` specifically A-trait-system Area: Trait system
Projects
None yet
Development

No branches or pull requests

5 participants