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

move to using Arc<dyn HttpClient> in azure_identity #799

Merged
merged 3 commits into from
Jun 14, 2022

Conversation

bmc-msft
Copy link
Contributor

@bmc-msft bmc-msft commented Jun 13, 2022

From discussions in a previous PR, the more common method in the SDK is to clone the Arc<dyn HttpClient>, rather than pass a reference.

#785 (comment)

Note, this uses the crate fix-hidden-lifetime-bug to work around an issue with async fn trait issues (ref: rust-lang/rust#63033).

Without this workaround, we see the error:

error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
  --> sdk/identity/src/client_credentials_flow/mod.rs:59:28
   |
59 |   ) -> Result<LoginResponse> {
   |  ____________________________^
60 | |     let encoded: String = form_urlencoded::Serializer::new(String::new())
61 | |         .append_pair("client_id", client_id.as_str())
62 | |         .append_pair("scope", &scopes.join(" "))
...  |
89 | |     serde_json::from_slice(&rsp_body).map_kind(ErrorKind::DataConversion)
90 | | }
   | |_^
   |
   = note: hidden type `impl futures::Future<Output = std::result::Result<client_credentials_flow::login_response::LoginResponse, azure_core::error::Error>>` captures lifetime '_#42r

@bmc-msft bmc-msft changed the title move to using Arc<dyn HttpClient> move to using Arc<dyn HttpClient> in azure_identity Jun 13, 2022
@bmc-msft bmc-msft marked this pull request as ready for review June 14, 2022 18:13
@bmc-msft bmc-msft requested a review from cataggar June 14, 2022 18:29
@@ -28,6 +28,8 @@ openssl = { version = "0.10", optional=true }
base64 = "0.13.0"
uuid = { version = "1.0", features = ["v4"] }
http = "0.2"
# work around https://github.com/rust-lang/rust/issues/63033
fix-hidden-lifetime-bug = "0.2"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😱

@bmc-msft bmc-msft merged commit a125b3f into Azure:main Jun 14, 2022
@bmc-msft bmc-msft deleted the move-to-arc-client branch June 14, 2022 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants