1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-27 09:42:57 +01:00

Fix type confusion in some scenarios (#3348)

* Fix type confusion in some scenarios

When the feature for rustls 0.22 is enabled, and rustls 0.23 is also
present in a project, there suddently exist multiple paths for errors
when building middleware chains due to the use of two consecutive `?`
operators without specifying the intermediate error type.

This commit addresses the issue by removing the first `?`, so that the
first error type will always be known, and the second `?` always has a
well defined implementation.

* Add CHANGES entry about type confusion

---------

Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
asonix 2024-05-14 00:45:35 -05:00 committed by GitHub
parent 3c9a930bd1
commit 33c47c0ba9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 4 deletions

View File

@ -9,6 +9,7 @@
### Changed
- Minimum supported Rust version (MSRV) is now 1.72.
- Avoid type confusion in rare circumstances
## 4.5.1

View File

@ -263,8 +263,9 @@ impl ServiceFactory<ServiceRequest> for AppRoutingFactory {
let guards = guards.borrow_mut().take().unwrap_or_default();
let factory_fut = factory.new_service(());
async move {
let service = factory_fut.await?;
Ok((path, guards, service))
factory_fut
.await
.map(move |service| (path, guards, service))
}
}));

View File

@ -470,8 +470,9 @@ impl ServiceFactory<ServiceRequest> for ScopeFactory {
let guards = guards.borrow_mut().take().unwrap_or_default();
let factory_fut = factory.new_service(());
async move {
let service = factory_fut.await?;
Ok((path, guards, service))
factory_fut
.await
.map(move |service| (path, guards, service))
}
}));