Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type confusion in some scenarios #3348

Merged
merged 3 commits into from May 14, 2024

Conversation

asonix
Copy link
Contributor

@asonix asonix commented May 3, 2024

PR Type

Bug Fix

PR Checklist

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made for the appropriate packages.
  • 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.

asonix added 2 commits May 3, 2024 14:03
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.
@asonix
Copy link
Contributor Author

asonix commented May 3, 2024

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"
}

@asonix
Copy link
Contributor Author

asonix commented May 12, 2024

Looking into updating actix-tls in actix-http for rustls 0.23 support and running into these same compile errors 😔

@asonix asonix mentioned this pull request May 12, 2024
5 tasks
@robjtede robjtede added B-semver-patch A-web project: actix-web labels May 14, 2024
@robjtede robjtede enabled auto-merge May 14, 2024 05:34
@robjtede robjtede added this pull request to the merge queue May 14, 2024
Merged via the queue into actix:master with commit 33c47c0 May 14, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-web project: actix-web B-semver-patch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants