-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
"Try invoking the function" hint #63100
Comments
@Centril why was this tagged async-await? |
|
I don't think that makes this an async/await issue in any way, though. 🤷♀️ |
It's a great suggestion either way. Going to take a crack at it if I may? |
Move to close this as PR #63337 now merged in nightly fixes this:
|
@Centril thoughts? |
The message for async/await is still bad:
Leaving this up to @estebank |
IMO the
|
@Patryk27 I feel like |
@estebank Thanks, I understand - I'm not certain about curly braces in this position, since it changes their meaning though (from denoting block to denoting location, depending on whether it is part of code block or message) and thus, to me, they are kinda confusing. IMO the |
😊 |
…trochenkov Suggest calling closure with resolved return type when appropriate Follow up to rust-lang#63337. CC rust-lang#63100. ``` error[E0308]: mismatched types --> $DIR/fn-or-tuple-struct-without-args.rs:46:20 | LL | let closure = || 42; | -- closure defined here LL | let _: usize = closure; | ^^^^^^^ | | | expected usize, found closure | help: use parentheses to call this closure: `closure()` | = note: expected type `usize` found type `[closure@$DIR/fn-or-tuple-struct-without-args.rs:45:19: 45:24]` ```
Hi,
Let's consider following code:
Right now it fails with the
expected usize, found fn item
message - I think it would be helpful if compiler bragged about missing parentheses when function's return type matches expected type:It may even help a little bit when dealing with
async
functions - recently I've written:... and it took me a few minutes to notice that what I actually wanted was
bar(foo())
.The text was updated successfully, but these errors were encountered: