Fix type confusion in some scenarios
PR Type
Bug Fix
PR Checklist
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [x] A changelog entry has been made for the appropriate packages.
- [x] Format code with the latest stable rustfmt.
- [ ] (Team) Label with affected crates and semver status.
Overview
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.
I originally found this issue while working on pict-rs. Here's a minimum reproduction:
[package]
name = "type-confusion"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
actix-web = { version = "4.5.1", features = ["rustls-0_22"] }
rustls = "0.23.5"
#[actix_web::main]
async fn main() -> std::io::Result<()> {
actix_web::HttpServer::new(|| actix_web::App::new().route("/", actix_web::web::get().to(index)))
.bind("127.0.0.1:9090")?
.run()
.await
}
async fn index() -> &'static str {
"Hewwo Mr Obama"
}
Looking into updating actix-tls in actix-http for rustls 0.23 support and running into these same compile errors :pensive: