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

Best-effort checks for @mut freezing are *too* conservative #6361

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

Best-effort checks for @mut freezing are *too* conservative #6361

nikomatsakis opened this issue May 9, 2013 · 3 comments
Labels
A-lifetimes Area: Lifetimes / regions C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@nikomatsakis
Copy link
Contributor

This test fails to compile but should not:

fn take_mut_slice<'a>(v: &'a mut [int]) -> &'a int { &v[0] }

fn main() {
    let mut x: ~[@mut [int]] = ~[@mut [3], @mut [4]];
    let a = take_mut_slice(x[0]);
    let b = take_mut_slice(x[1]);
    *a + *b;
}

I get the following errors:

/home/nmatsakis/tmp/best-effort.rs:6:27: 6:30 error: cannot borrow `(*(*x)[])[]` as mutable more than once at at a time                                          
/home/nmatsakis/tmp/best-effort.rs:6     let b = take_mut_slice(x[1]);
                                                                ^~~
/home/nmatsakis/tmp/best-effort.rs:5:27: 5:30 note: second borrow of `(*(*x)[])[]` as mutable occurs here                                                        
/home/nmatsakis/tmp/best-effort.rs:5     let a = take_mut_slice(x[0]);
                                                                ^~~
@emberian
Copy link
Member

emberian commented Jul 5, 2013

still relevant

@metajack
Copy link
Contributor

metajack commented Sep 5, 2013

Visiting for triage. Still relevant, but nothing to add.

@thestinger
Copy link
Contributor

@mut was removed from the language.

flip1995 pushed a commit to flip1995/rust that referenced this issue Nov 23, 2020
Small grammar, punctuation, and code style improvements to docs

changelog: Made small grammar, punctuation, and code style improvements to docs

I recently found some places in rust-lang/rust that had lists without spaces after commas, which led me to look for more places, which led me over here to find:

- Some similar lists in code examples that could use spaces after commas to be idiomatic Rust style
- Some lists in documentation text that didn't have spaces after commas, needed an Oxford comma (fight me), or were otherwise misformatted
- Some other grammar improvements in the area of the other changes

These changes should only be in user-facing documentation or output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lifetimes Area: Lifetimes / regions C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

4 participants