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: errors from free variables should highlight their span, not span of their lambda expression #51170

Closed
pnkfelix opened this issue May 29, 2018 · 0 comments
Assignees
Labels
A-NLL Area: Non-lexical lifetimes (NLL) NLL-diagnostics Working towards the "diagnostic parity" goal
Milestone

Comments

@pnkfelix
Copy link
Member

pnkfelix commented May 29, 2018

NLL has regressed some test cases in that it will highlight the whole span of a lambda expression (i.e. the |args, ... | { body ... }) rather than focus in on the occurrence(s) of the relevant free variable(s) within that lambda expression.

One instances of this is:

https://github.com/rust-lang/rust/blob/master/src/test/ui/region-borrow-params-issue-29793-small.nll.stderr

compare that output with that from the old AST borrowck:

https://github.com/rust-lang/rust/blob/master/src/test/ui/region-borrow-params-issue-29793-small.nll.stderr


(In addition, AST borrowck is noting that such a capture of a free variable is occurring, and highlights the parameter list saying "capture occurs here"; but this additional detail seems like very low priority to fix, if we want to fix it at all.)

@estebank estebank added the NLL-diagnostics Working towards the "diagnostic parity" goal label May 29, 2018
@matthewjasper matthewjasper added A-NLL Area: Non-lexical lifetimes (NLL) WG-compiler-nll labels Jul 8, 2018
@matthewjasper matthewjasper self-assigned this Jul 8, 2018
bors added a commit that referenced this issue Jul 21, 2018
[NLL] Mutability errors

cc #51028
cc #51170
cc #46559
Closes #46629

* Better explain why the place is immutable ("immutable item" is gone)
* Distinguish &T and *const T
* Use better spans when a mutable borrow is for a closure capture

r? @pnkfelix
cramertj added a commit to cramertj/rust that referenced this issue Aug 3, 2018
…elix

[NLL] Use smaller spans for errors involving closure captures

Closes rust-lang#51170
Closes rust-lang#46599

Error messages involving closures now point to the captured variable/closure args.

r? @pnkfelix
bors added a commit that referenced this issue Aug 5, 2018
[NLL] Use smaller spans for errors involving closure captures

Closes #51170
Closes #46599

Error messages involving closures now point to the captured variable/closure args.

r? @pnkfelix
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

4 participants