tower-rs / tower

async fn(Request) -> Result<Response, Error>

Home Page:https://docs.rs/tower

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tower 5.0 : error[E0015]: cannot call non-const fn `Identity::new` in constant functions

LeonGGX opened this issue · comments

Switching from tower 0.4 to tower 0.5.0 in an application using axum, couldn't compile tower lib due to the following error :
Compiling tower v0.5.0
error[E0015]: cannot call non-const fn Identity::new in constant functions
--> C:...\tower-0.5.0\src\builder\mod.rs:120:20
|
120 | layer: Identity::new(),
| ^^^^^^^^^^^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants

System : Windows 11
Rust : latest stable version.

The problem remained for me until I deleted the target directory and Cargo.lock.