Skip to content
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

NLL: diagnostic advising statementizing a block's tail expression. #54556

Closed
pnkfelix opened this issue Sep 25, 2018 · 1 comment
Closed

NLL: diagnostic advising statementizing a block's tail expression. #54556

pnkfelix opened this issue Sep 25, 2018 · 1 comment
Assignees
Labels
A-NLL Area: Non-lexical lifetimes (NLL) NLL-diagnostics Working towards the "diagnostic parity" goal

Comments

@pnkfelix
Copy link
Member

Spawned off of #21114.

My new brain child for how to address the long standing issue of compiler error messages that seem to be "magically" resolved by adding a semi-colon is to try to improve our diagnostics so that 1. users are told up front about where adding a semi-colon might help and 2. users get an explanation as to why it matters.

@pnkfelix
Copy link
Member Author

pnkfelix commented Sep 25, 2018

(It has been duly noted that whatever this diagnostic is, it is not allowed to contain the newly coined word "statementize" or any derivative conjugation thereof.)

bors added a commit that referenced this issue Oct 7, 2018
…r=nikomatsakis

NLL: temps in block tail expression diagnostic

This change adds a diagnostic that explains when temporaries in a block tail expression live longer than block local variables that they borrow, and attempts to suggest turning the tail expresion into a statement (either by adding a semicolon at the end, when its result value is clearly unused, or by introducing a `let`-binding for the result value and then returning that).

Fix #54556
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-NLL Area: Non-lexical lifetimes (NLL) NLL-diagnostics Working towards the "diagnostic parity" goal
Projects
None yet
Development

No branches or pull requests

1 participant