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

mut qualifier cannot be applied to closure arguments #6153

Closed
nikomatsakis opened this issue May 1, 2013 · 3 comments
Closed

mut qualifier cannot be applied to closure arguments #6153

nikomatsakis opened this issue May 1, 2013 · 3 comments
Labels
A-grammar Area: The grammar of Rust

Comments

@nikomatsakis
Copy link
Contributor

The following example should parse and work correctly:

fn swap(f: &fn(~[int]) -> ~[int]) -> ~[int] {
    let x = ~[1, 2, 3];
    f(x)
}

fn main() {
    let v = swap(|mut x| { x.push(4); x });
    let w = do swap |mut x| { x.push(4); x };
    assert_eq!(v, w);
}

It does not parse now (mut in identifier position)

@nikomatsakis
Copy link
Contributor Author

Nominating for a milestone, though I'm not really clear on which one. Well-defined? Feature complete? It's a backwards compatible change to the grammar, anyhow.

@graydon
Copy link
Contributor

graydon commented May 2, 2013

accepted for feature complete

@catamorphism
Copy link
Contributor

This works now. Adding a test.

bors pushed a commit to rust-lang-ci/rust that referenced this issue Oct 24, 2020
bors added a commit to rust-lang-ci/rust that referenced this issue Oct 24, 2020
Fix two ICEs caused by ty.is_{sized,freeze}

Fixes rust-lang#6153
Properly fixes rust-lang#6139

The test case in rust-lang#6153 is kind of weird. Even removing one of the arguments of the `foo` function prevented the ICE. I think this test case is actually minimal.

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-grammar Area: The grammar of Rust
Projects
None yet
Development

No branches or pull requests

3 participants