Skip to content

NLL diagnostics lost special notes re: free ("outer") variables in Fn/FnMut/etc closures #51028

Closed
@pnkfelix

Description

@pnkfelix

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...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-NLLArea: Non-lexical lifetimes (NLL)NLL-diagnosticsWorking towards the "diagnostic parity" goal

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions