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

Unboxed closures can mutate captures of immutable variables #18335

Closed
bkoropoff opened this issue Oct 26, 2014 · 0 comments · Fixed by #18337
Closed

Unboxed closures can mutate captures of immutable variables #18335

bkoropoff opened this issue Oct 26, 2014 · 0 comments · Fixed by #18337

Comments

@bkoropoff
Copy link
Contributor

Example that shouldn't compile:

#![feature(unboxed_closures)]

fn main() {
    let x = 0u;
    move |&mut:| x = 1;
}

Note that this currently ICEs due to #18238, but it's still a problem once that is fixed.

bkoropoff added a commit to bkoropoff/rust that referenced this issue Oct 26, 2014
- 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.
bkoropoff added a commit to bkoropoff/rust that referenced this issue Oct 26, 2014
bkoropoff added a commit to bkoropoff/rust that referenced this issue Oct 26, 2014
lnicola pushed a commit to lnicola/rust that referenced this issue Oct 22, 2024
…lnicola

internal: Fix editorconfig glob

Had been testing Zed's editorconfig branch on r-a and noticed that something was odd with yaml files.

https://spec.editorconfig.org/#glob-expressions

> {s1,s2,s3}

> any of the strings given (separated by commas, can be nested) (But {s1} only matches {s1} literally.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant