-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Special case suggestion for missing tail expression when dealing with Ok(())
and Some(())
#90553
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
D-invalid-suggestion
Diagnostics: A structured suggestion resulting in incorrect code.
D-papercut
Diagnostics: An error or lint that needs small tweaks.
P-low
Low priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
(Just need to figure out a way to detect whether the expression was the final one in a block.) |
That looks good! |
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Nov 18, 2021
…ents, r=estebank Improve suggestions for compatible variants on type mismatch. Fixes rust-lang#90553. Before:  After:  r? `@estebank`
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Nov 18, 2021
…ents, r=estebank Improve suggestions for compatible variants on type mismatch. Fixes rust-lang#90553. Before:  After:  r? ``@estebank``
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Nov 19, 2021
…ents, r=estebank Improve suggestions for compatible variants on type mismatch. Fixes rust-lang#90553. Before:  After:  r? ```@estebank```
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Nov 19, 2021
…ents, r=estebank Improve suggestions for compatible variants on type mismatch. Fixes rust-lang#90553. Before:  After:  r? ````@estebank````
Re-opening this, because it doesn't work yet for
|
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Feb 17, 2022
…ion-with-desugaring, r=estebank Compatible variants suggestion with desugaring This fixes rust-lang#90553 for `for` loops and other desugarings. r? `@estebank`
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Mar 2, 2022
…ion-with-desugaring, r=estebank Compatible variants suggestion with desugaring This fixes rust-lang#90553 for `for` loops and other desugarings. r? `@estebank`
Dylan-DPC
added a commit
to Dylan-DPC/rust
that referenced
this issue
Mar 2, 2022
…ion-with-desugaring, r=estebank Compatible variants suggestion with desugaring This fixes rust-lang#90553 for `for` loops and other desugarings. r? ``@estebank``
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
D-invalid-suggestion
Diagnostics: A structured suggestion resulting in incorrect code.
D-papercut
Diagnostics: An error or lint that needs small tweaks.
P-low
Low priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The suggestion in the following code isn't great:
It makes sense why it happens: the
while let
expression resolves to type()
, it's the tail expression of anasync fn
that returnsOption<()>
, so wrapping the expression inSome(())
would make the type checker happy, but suggesting that seems almost always wrong? I think I would prefer it if we special cased this and didn't gave a suggestion forResult<(), _>
orOption<()>
.The text was updated successfully, but these errors were encountered: