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 diagnostics lost special notes re: free ("outer") variables in Fn/FnMut/etc closures #51028

Closed
5 of 6 tasks
pnkfelix opened this issue May 24, 2018 · 3 comments
Closed
5 of 6 tasks
Labels
A-NLL Area: Non Lexical Lifetimes (NLL) NLL-diagnostics Working torwads the "diagnostic parity" goal
Milestone

Comments

@pnkfelix
Copy link
Member

pnkfelix commented May 24, 2018

The following tests used to have nice specific reports about the role of Fn or FnMut in the code (and how it impacts the uses of free variables, aka "outer variables", in the body of the closure), but all of that has been lost in NLL.

  • borrowck/borrowck-in-static.rs
  • issue-21600.rs
  • suggestions/closure-immutable-outer-variable.rs
  • suggestions/fn-closure-mutable-capture.rs
  • borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs

I suspect the following are also fundamentally related, though the particular diagnostics differ. (We may well want to branch them off into their own independent issues.)

  • closure_context/issue-42065.rs
    • (here instead of reporting an error about Fn/FnMut/FnOnce, we instead point out that the closure in question cannot be invoked multiple times; i.e. we must have inferred it to be an FnOnce, but that isn't part of the presented error message, for better or for worse).

(This list of tests is drawn from an informal paper document that I have been using to keep notes for myself as I work on this...)

@pnkfelix pnkfelix added A-NLL Area: Non Lexical Lifetimes (NLL) WG-compiler-nll NLL-diagnostics Working torwads the "diagnostic parity" goal labels May 24, 2018
@nikomatsakis
Copy link
Contributor

nikomatsakis commented Jul 3, 2018

I don't think issue-21600.rs fits with the others here wait

@nikomatsakis
Copy link
Contributor

I categorize this as Release Candidate — doesn't feel like a must have for Edition Preview

@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
bors added a commit that referenced this issue Jul 22, 2018
…pnkfelix

[NLL] Small move error reporting improvements

* Use a MirBorrowckContext when reporting errors to be more uniform with other error reporting
* Add a special message for the case of trying to move from capture variables in `Fn` and `FnMut` closures.

part of #51028
@matthewjasper matthewjasper removed their assignment Jul 22, 2018
@nikomatsakis
Copy link
Contributor

Closing, this seems done.

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 torwads the "diagnostic parity" goal
Projects
None yet
Development

No branches or pull requests

3 participants