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

'cargo test --features http2' fails with many "associated function is never used" #2794

Closed
RalfJung opened this issue Mar 27, 2022 · 2 comments
Labels
C-bug Category: bug. Something is wrong. This is bad!

Comments

@RalfJung
Copy link
Contributor

Version
Current git master

Platform
Linux 5.16.0-4-amd64 #1 SMP PREEMPT Debian 5.16.12-1 (2022-03-08) x86_64 GNU/Linux

Description
Running cargo test --features http2 fails with a bunch of errors:

error: unused import: `self::never::Never`
  --> src/common/mod.rs:32:16
   |
32 | pub(crate) use self::never::Never;
   |                ^^^^^^^^^^^^^^^^^^
   |
note: the lint level is defined here
  --> src/lib.rs:5:24
   |
5  | #![cfg_attr(test, deny(warnings))]
   |                        ^^^^^^^^
   = note: `#[deny(unused_imports)]` implied by `#[deny(warnings)]`

error: variant is never constructed: `Body`
  --> src/error.rs:52:5
   |
52 |     Body,
   |     ^^^^
   |
note: the lint level is defined here
  --> src/lib.rs:5:24
   |
5  | #![cfg_attr(test, deny(warnings))]
   |                        ^^^^^^^^
   = note: `#[deny(dead_code)]` implied by `#[deny(warnings)]`
note: `Kind` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
  --> src/error.rs:20:10
   |
20 | #[derive(Debug)]
   |          ^^^^^
   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)

error: variant is never constructed: `BodyWrite`
  --> src/error.rs:55:5
   |
55 |     BodyWrite,
   |     ^^^^^^^^^
   |
note: `Kind` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
  --> src/error.rs:20:10
   |
20 | #[derive(Debug)]
   |          ^^^^^
   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)

error: associated function is never used: `new_body`
   --> src/error.rs:298:19
    |
298 |     pub(super) fn new_body<E: Into<Cause>>(cause: E) -> Error {
    |                   ^^^^^^^^

error: associated function is never used: `new_body_write`
   --> src/error.rs:303:19
    |
303 |     pub(super) fn new_body_write<E: Into<Cause>>(cause: E) -> Error {
    |                   ^^^^^^^^^^^^^^

error: associated function is never used: `from_inner`
  --> src/ext.rs:34:19
   |
34 |     pub(crate) fn from_inner(inner: h2::ext::Protocol) -> Self {
   |                   ^^^^^^^^^^

error: associated function is never used: `into_inner`
  --> src/ext.rs:38:19
   |
38 |     pub(crate) fn into_inner(self) -> h2::ext::Protocol {
   |                   ^^^^^^^^^^

error: struct is never constructed: `Pending`
   --> src/upgrade.rs:109:19
    |
109 | pub(super) struct Pending {
    |                   ^^^^^^^

error: function is never used: `pending`
   --> src/upgrade.rs:114:15
    |
114 | pub(super) fn pending() -> (Pending, OnUpgrade) {
    |               ^^^^^^^

error: associated function is never used: `fulfill`
   --> src/upgrade.rs:235:19
    |
235 |     pub(super) fn fulfill(self, upgraded: Upgraded) {
    |                   ^^^^^^^

error: variant is never constructed: `Default`
  --> src/common/exec.rs:34:5
   |
34 |     Default,
   |     ^^^^^^^
   |
note: `Exec` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis
  --> src/common/exec.rs:32:10
   |
32 | #[derive(Clone)]
   |          ^^^^^
   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)

error: variant is never constructed: `Executor`
  --> src/common/exec.rs:35:5
   |
35 |     Executor(Arc<dyn Executor<BoxSendFuture> + Send + Sync>),
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: `Exec` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis
  --> src/common/exec.rs:32:10
   |
32 | #[derive(Clone)]
   |          ^^^^^
   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)

error: associated function is never used: `execute`
  --> src/common/exec.rs:41:19
   |
41 |     pub(crate) fn execute<F>(&self, fut: F)
   |                   ^^^^^^^

error: associated function is never used: `extra_mut`
   --> src/body/body.rs:237:8
    |
237 |     fn extra_mut(&mut self) -> &mut Extra {
    |        ^^^^^^^^^

error: associated function is never used: `is_exact`
  --> src/body/length.rs:78:19
   |
78 |     pub(crate) fn is_exact(&self) -> bool {
   |                   ^^^^^^^^

error: could not compile `hyper` due to 15 previous errors

Looks like the #![cfg_attr(test, deny(warnings))] is a bit overeager here?

@RalfJung RalfJung added the C-bug Category: bug. Something is wrong. This is bad! label Mar 27, 2022
@RalfJung
Copy link
Contributor Author

Some other combinations of features fail in harder to fix ways:

$ cargo test --features http2,client,server
error[E0599]: no method named `kind` found for struct `error::Error` in the current scope
   --> src/client/dispatch.rs:320:22
    |
320 |         match (err.0.kind(), err.1) {
    |                      ^^^^ method not found in `error::Error`
    |
   ::: src/error.rs:11:1
    |
11  | pub struct Error {
    | ---------------- method `kind` not found for this
$ cargo test --features http1,http2,client,server
error[E0560]: struct `h1::ParseContext<'_>` has no field named `h1_header_read_timeout`
   --> src/proto/h1/io.rs:730:17
    |
730 |                 h1_header_read_timeout: None,
    |                 ^^^^^^^^^^^^^^^^^^^^^^ `h1::ParseContext<'_>` does not have this field
    |
    = note: available fields are: `cached_headers`, `req_method`, `h1_parser_config`, `preserve_header_case`, `h09_responses`

error[E0560]: struct `h1::ParseContext<'_>` has no field named `h1_header_read_timeout_fut`
   --> src/proto/h1/io.rs:731:17
    |
731 |                 h1_header_read_timeout_fut: &mut None,
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ `h1::ParseContext<'_>` does not have this field
    |
    = note: available fields are: `cached_headers`, `req_method`, `h1_parser_config`, `preserve_header_case`, `h09_responses`

[and many more]

@RalfJung
Copy link
Contributor Author

Fixed by #2795

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug. Something is wrong. This is bad!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant