Skip to content

Compiler suggests to import private trait #57780

Closed
@In-line

Description

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

Activity

changed the title [-]Poor quality errors/suggestions.[/-] [+]Poor quality warnings/suggestions.[/+] on Jan 20, 2019
In-line

In-line commented on Jan 20, 2019

@In-line
ContributorAuthor

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
added
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.
A-diagnosticsArea: Messages for errors, warnings, and lints
A-resolveArea: Name/path resolution done by `rustc_resolve` specifically
on Jan 20, 2019
leonardo-m

leonardo-m commented on Jan 20, 2019

@leonardo-m

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

tmandry

tmandry commented on Mar 26, 2019

@tmandry
Member

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.

changed the title [-]Poor quality warnings/suggestions.[/-] [+]Compiler suggests to import private trait[/+] on Apr 23, 2019
estebank

estebank commented on Aug 15, 2019

@estebank
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

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

        Participants

        @Centril@estebank@tmandry@In-line@leonardo-m

        Issue actions

          Compiler suggests to import private trait · Issue #57780 · rust-lang/rust