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

Freezing is outdated #1313

Closed
dalance opened this issue Mar 9, 2020 · 0 comments
Closed

Freezing is outdated #1313

dalance opened this issue Mar 9, 2020 · 0 comments

Comments

@dalance
Copy link
Contributor

dalance commented Mar 9, 2020

I think freezing by borrow is outdated by NLL.
So scope/borrow/freeze.md may be required to re-written.
In my opinion, freezing can be explained in variable_bindings/freeze.md with the following code.

fn main() {
    let mut _mutable_integer = 7i32;

    {
        // Shadowing by immutable `_mutable_integer`
        let _mutable_integer = _mutable_integer;

        // Error! `_mutable_integer` is frozen in this scope
        _mutable_integer = 50;
        // FIXME ^ Comment out this line

        // `_mutable_integer` goes out of scope
    }

    // Ok! `_mutable_integer` is not frozen in this scope
    _mutable_integer = 3;
}
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

No branches or pull requests

1 participant