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

Failure to compile with --cfg tokio_unstable and the process and rt features enabled #4681

Closed
Noah-Kennedy opened this issue May 11, 2022 · 0 comments · Fixed by #4682
Closed
Labels
A-tokio Area: The main tokio crate C-bug Category: This is a bug. M-metrics Module: tokio/runtime/metrics

Comments

@Noah-Kennedy
Copy link
Contributor

If using the unstable features with only the process and rt features enabled, tokio will fail to compile:

noah@resf-attack-drone ‹ master ●●● › : ~/CLionProjects/smoke
[0] % cargo check
    Checking tokio v1.18.2
error[E0432]: unresolved import `crate::runtime::IoDriverMetrics`
  --> /home/noah/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.18.2/src/io/driver/metrics.rs:20:24
   |
20 |         pub(crate) use crate::runtime::IoDriverMetrics;
   |                        ^^^^^^^^^^^^^^^^---------------
   |                        |               |
   |                        |               help: a similar name exists in the module: `WorkerMetrics`
   |                        no `IoDriverMetrics` in `runtime`

error[E0282]: type annotations needed
   --> /home/noah/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.18.2/src/io/driver/mod.rs:303:18
    |
303 |             self.inner().map(|inner| f(&inner.metrics))
    |                  ^^^^^ cannot infer type
    |
    = note: type must be known at this point

error[E0599]: no method named `inner` found for reference `&io::driver::Handle` in the current scope
   --> /home/noah/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.18.2/src/io/driver/mod.rs:303:18
    |
303 |             self.inner().map(|inner| f(&inner.metrics))
    |                  ^^^^^-- help: remove the arguments
    |                  |
    |                  field, not a method

Some errors have detailed explanations: E0282, E0432, E0599.
For more information about an error, try `rustc --explain E0282`.
error: could not compile `tokio` due to 3 previous errors

I ran a bisect and found it was introduced here:

769fb1547fc50406fc2adb23cdf17a1aaf5744ac is the first bad commit
commit 769fb1547fc50406fc2adb23cdf17a1aaf5744ac
Author: Lucio Franco <[email protected]>
Date:   Thu Feb 24 13:39:37 2022 -0500

    tokio: Add initial io driver metrics (#4507)

 .gitignore                           |  2 +
 tests-integration/Cargo.toml         |  2 +-
 tokio/src/io/driver/metrics.rs       | 22 +++++++++
 tokio/src/io/driver/mod.rs           | 38 +++++++++++++++-
 tokio/src/lib.rs                     |  2 +-
 tokio/src/macros/cfg.rs              |  6 +++
 tokio/src/runtime/metrics/io.rs      | 30 +++++++++++++
 tokio/src/runtime/metrics/mod.rs     |  5 +++
 tokio/src/runtime/metrics/runtime.rs | 87 ++++++++++++++++++++++++++++++++++++
 tokio/src/runtime/mod.rs             |  4 ++
 tokio/tests/rt_metrics.rs            | 34 ++++++++++++++
 11 files changed, 229 insertions(+), 3 deletions(-)
 create mode 100644 tokio/src/io/driver/metrics.rs
 create mode 100644 tokio/src/runtime/metrics/io.rs

Compilation is only successful with the net feature.

@Noah-Kennedy Noah-Kennedy added C-bug Category: This is a bug. A-tokio Area: The main tokio crate M-metrics Module: tokio/runtime/metrics labels May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-bug Category: This is a bug. M-metrics Module: tokio/runtime/metrics
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant