-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Suggest await
in more situations where infer types are involved
#91022
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,4 +54,21 @@ async fn suggest_await_on_match_expr() { | |
}; | ||
} | ||
|
||
async fn dummy_result() -> Result<(), ()> { | ||
Ok(()) | ||
} | ||
|
||
#[allow(unused)] | ||
async fn suggest_await_in_generic_pattern() { | ||
match dummy_result() { | ||
//~^ HELP consider `await`ing on the `Future` | ||
//~| HELP consider `await`ing on the `Future` | ||
//~| SUGGESTION .await | ||
Ok(_) => {} | ||
//~^ ERROR mismatched types [E0308] | ||
Err(_) => {} | ||
//~^ ERROR mismatched types [E0308] | ||
} | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder, can this test be marked as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I see. Fair enough, leave as is. |
||
fn main() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure there's code like this somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is from
fn equals(Ty, Ty) -> bool
.We could possibly unify them by adding an
enum Mode { None, NumInfer, Infer }
or something. The complication is that this equals fn cares about the non-Ty substs in Adt, where TyS::same_ty (and the function I added) doesn't...Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.
fn equals
has to make sure the whole type are the same because this is used to determine whether it can be replaced with_
in the output. It's fine.