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

Assorted unboxed closure fixes #18337

Merged
merged 5 commits into from
Oct 28, 2014
Merged

Conversation

bkoropoff
Copy link
Contributor

The most substantial change here is that we disallow capture-by-value FnMut closures from mutating upvars that are not declared mut, which is consistent with the behavior of procs and of other unboxed closure varieties, although it is notable that the equivalent desugaring would permit it since structure fields cannot have individual mutability.

This also fixes an ICE, upvars sometimes not being marked as used mutably, and some bad diagnostic messages. There are still some improvements to be made here (#18330), but it's a longstanding issue that I'll try to address with a different PR.

Closes #18238
Closes #18335
Closes #18336

r? @pcwalton

- Correctly categorize env pointer deref for `FnMut` as declared
  rather than inherited.  This fixes an assert in borrowck.
  Closes rust-lang#18238
- Categorize env pointer deref as mutable only if the closure is
  `FnMut` *and* the original variable is declared mutable.  This
  disallows capture-by-value `FnMut` closures from mutating captured
  variables that aren't declared mutable.  This is a difference
  from the equivalent desugared code which would permit it, but
  it is consistent with the behavior of procs.  Closes rust-lang#18335
- Avoid computing info about the env pointer if there isn't one.
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Oct 27, 2014
@bors bors merged commit 5662bba into rust-lang:master Oct 28, 2014
lnicola pushed a commit to lnicola/rust that referenced this pull request Oct 22, 2024
fix: private items are shown in completions for modules in fn body

Close: rust-lang#18287
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants