Skip to content

Update tower version to fix build issue #553

@ShawnROGrady

Description

@ShawnROGrady

Bug Report

Version

tonic v0.4.0

Description

I tried updating tonic for one of my projects to finish migrating to v1 of tokio and began seeing build issues:

Compiling tower v0.4.0
error[E0432]: unresolved imports `tower_layer::layer_fn`, `tower_layer::LayerFn`
 --> /Users/Shawn/.cargo/registry/src/github.com-1ecc6299db9ec823/tower-0.4.0/src/util/boxed/sync.rs:1:19
  |
1 | use tower_layer::{layer_fn, LayerFn};
  |                   ^^^^^^^^  ^^^^^^^
  |                   |         |
  |                   |         no `LayerFn` in the root
  |                   |         help: a similar name exists in the module: `Layer`
  |                   no `layer_fn` in the root

error[E0432]: unresolved imports `tower_layer::layer_fn`, `tower_layer::LayerFn`
 --> /Users/Shawn/.cargo/registry/src/github.com-1ecc6299db9ec823/tower-0.4.0/src/util/boxed/unsync.rs:1:19
  |
1 | use tower_layer::{layer_fn, LayerFn};
  |                   ^^^^^^^^  ^^^^^^^
  |                   |         |
  |                   |         no `LayerFn` in the root
  |                   |         help: a similar name exists in the module: `Layer`
  |                   no `layer_fn` in the root

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0432`.
error: could not compile `tower`.

It appears as though this issue has been fixed in a newer version of tower (release: https://github.com/tower-rs/tower/releases/tag/tower-0.4.1, commit: tower-rs/tower@b447771)

EDIT: this may be a cargo issue because explicitly adding tower = { version = "0.4.1" } to my Cargo.toml (I'm not directly depending on tower so I didn't previously have this dependency) resolved the issue. Still might be best to update tonic/Cargo.toml to set the tower version to ^0.4.1 so others don't run in to similar issues updating.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions