You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to add an async function argument to a function and run into a situation where it get a mismatched types error although the types I'm presented in the error message are actually both identical:
Compiling mainmatter-website-mailer v0.0.0 (/Users/marcoow/Code/mainmatter-website-mailer)
error[E0308]: mismatched types
--> src/lib.rs:43:32
|
43 | Ok(payload) => send_message(payload, &api_key, &request_sendgrid).await,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected trait `for<'r> <for<'r> fn(&'r str, std::string::String) -> impl for<'r> Future<Output = u16> {request_sendgrid} as FnOnce<(&'r str, std::string::String)>>`
found trait `for<'r> <for<'r> fn(&'r str, std::string::String) -> impl for<'r> Future<Output = u16> {request_sendgrid} as FnOnce<(&'r str, std::string::String)>>`
note: the lifetime requirement is introduced here
--> src/lib.rs:53:104
|
53 | pub async fn send_message<Fut>(payload: Payload, api_key: &str, sendgrid: impl FnOnce(&str, String) -> Fut) -> Result<Response>
| ^^^
For more information about this error, try `rustc --explain E0308`.
error: could not compile `mainmatter-website-mailer` due to previous error
The text was updated successfully, but these errors were encountered:
Thanks, that does look like a bug in the error message. Could you create a more minimal example for easier reproduction, or at least share the full code needed for reproducing the error (if your code is public, you could create a branch for this isse with the broken state)?
I'm trying to add an async function argument to a function and run into a situation where it get a mismatched types error although the types I'm presented in the error message are actually both identical:
I'm aware I'm almost 100% certainly doing sth. wrong, still the note there seems probably wrong as well?
I tried this code:
I expected to see this happen: 2 different types in the error message
Instead, this happened: 2 equal types in the error message
Meta
rustc --version --verbose
:Backtrace
The text was updated successfully, but these errors were encountered: