Skip to content

Conversation

bobrik
Copy link
Contributor

@bobrik bobrik commented Oct 15, 2025

It was removed in #2339

Now clippy is unhappy about us requiring it in examples:

warning: invalid feature `tower` in required-features of target `tower-client`: `tower` is not present in [features] section
warning: invalid feature `tower` in required-features of target `tower-server`: `tower` is not present in [features] section

It was removed in hyperium#2339

Now clippy is unhappy about us requiring it in examples:

```
warning: invalid feature `tower` in required-features of target `tower-client`: `tower` is not present in [features] section
warning: invalid feature `tower` in required-features of target `tower-server`: `tower` is not present in [features] section
```
@bobrik
Copy link
Contributor Author

bobrik commented Oct 15, 2025

Perhaps the right thing to do is to reintroduce it. cc @dfawley, @arjan-bal

@dfawley
Copy link
Collaborator

dfawley commented Oct 15, 2025

Possibly. @arjan-bal do you remember why you removed it?

@arjan-bal
Copy link
Collaborator

Hi @bobrik, thanks for reporting this.

In #2339 I was running into issues with udeps check in the CI. The udeps check runs on the entire Cargo workspace. When the tower feature exists in the examples crate, the check would fail with the following error why analysing the grpc crate.

cargo udeps --no-default-features --features tower
error: package `grpc v0.9.0-alpha.1 (/path/to/tonic/grpc)` does not have feature `tower`

help: an optional dependency with that name exists, but the `features` table includes it with the "dep:" syntax so it does not have an implicit feature with that name
Dependency `tower` would be enabled by these features:
        - `_runtime-tokio`

This seems to be happening because cargo creates a feature for each optional dependency under the hood. udeps is trying to find the feature named tower in the grpc crate, but can't find it.

When I try to add a feature named tower which simply enables dep:tower, udeps complains that the feature is unused:

cargo udeps --no-default-features --features tower` on grpc (55/67)
      Checking tokio v1.48.0
      Checking tokio-util v0.7.16
      Checking tokio-stream v0.1.17
      Checking tonic v0.14.1 (/home/runner/work/tonic/tonic/tonic)
      Checking h2 v0.4.12
      Checking tower v0.5.2
      Checking hyper v1.7.0
      Checking grpc v0.9.0-alpha.1 (/home/runner/work/tonic/tonic/grpc)
      Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.85s
  info: Loading depinfo from "/home/runner/work/tonic/tonic/target/debug/deps/tonic-0640da7d9d17aa64.d"
  info: Loading depinfo from "/home/runner/work/tonic/tonic/target/debug/deps/grpc-2666c6a3d9526f13.d"
  unused dependencies:
  `grpc v0.9.0-alpha.1 (/home/runner/work/tonic/tonic/grpc)`
  └─── dependencies
       └─── "tower"
  Note: These dependencies might be used by other targets.
        To find dependencies that are not used by any target, enable `--all-targets`.
  Note: They might be false-positive.
        For example, `cargo-udeps` cannot detect usage of crates that are only used in doc-tests.
        To ignore some dependencies, write `package.metadata.cargo-udeps.ignore` in Cargo.toml.

I'm unsure if this is a bug in udeps.

I (incorrectly) assumed that the tower feature was not required in the examples crate and removed it. I re-checked and #2339 seems to have broken the tower-client and tower-server examples' builds.


The correct fix would be to re-introduce the feature and keep the udeps check passing.

@LucioFranco do you know how we could fix the problem I'm facing with udeps test? I have a PR (arjan-bal#7) with the commits which fail with the errors I mentioned above.

@LucioFranco
Copy link
Member

oh oops I accidentally updated this PR with updates from main.

@arjan-bal that is a good question, I honestly don't know the answer. I would say try to re-open that PR that re-introduces the feature and then we can get someone who knows the tool a bit better to help us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants