-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
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
estebank
added
A-diagnostics
Area: Messages for errors, warnings, and lints
P-low
Low priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
D-papercut
Diagnostics: An error or lint that needs small tweaks.
D-invalid-suggestion
Diagnostics: A structured suggestion resulting in incorrect code.
labels
Nov 4, 2021
(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: ![image](https://user-images.githubusercontent.com/783247/140385675-6ff41090-eca2-41bc-b161-99c5dabfec61.png) After: ![image](https://user-images.githubusercontent.com/783247/140385748-20cf26b5-ea96-4e56-8af2-5fe1ab16fd3b.png) 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: ![image](https://user-images.githubusercontent.com/783247/140385675-6ff41090-eca2-41bc-b161-99c5dabfec61.png) After: ![image](https://user-images.githubusercontent.com/783247/140385748-20cf26b5-ea96-4e56-8af2-5fe1ab16fd3b.png) 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: ![image](https://user-images.githubusercontent.com/783247/140385675-6ff41090-eca2-41bc-b161-99c5dabfec61.png) After: ![image](https://user-images.githubusercontent.com/783247/140385748-20cf26b5-ea96-4e56-8af2-5fe1ab16fd3b.png) 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: ![image](https://user-images.githubusercontent.com/783247/140385675-6ff41090-eca2-41bc-b161-99c5dabfec61.png) After: ![image](https://user-images.githubusercontent.com/783247/140385748-20cf26b5-ea96-4e56-8af2-5fe1ab16fd3b.png) 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``
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in 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: