Skip to content

Compiler suggests to import private trait #57780

Closed
@In-line

Description

@In-line
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyA-trait-systemArea: Trait system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions