Skip to content

Implicit copy of pinned kind runs destructor twice #985

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

Closed
brson opened this issue Sep 27, 2011 · 1 comment
Closed

Implicit copy of pinned kind runs destructor twice #985

brson opened this issue Sep 27, 2011 · 1 comment
Assignees
Labels
A-type-system Area: Type system

Comments

@brson
Copy link
Contributor

brson commented Sep 27, 2011

resource r(i: @mutable int) {
    *i = *i + 1;
}

fn movearg(i: r) {
    // Implicit copy to mutate reference i
    let j <- i;
}

fn main() {
    let i = @mutable 0;
    {
        let j <- r(i);
        movearg(j);
    }
    log_err *i;
    // nooooooo. destructor ran twice
    assert *i == 2;
}
@brson
Copy link
Contributor Author

brson commented Sep 27, 2011

marijn: brson: i think mut.rs, when inserting a value into the mut_map, could check whether it is an argument

@ghost ghost assigned brson Sep 27, 2011
@brson brson closed this as completed in e1ba559 Sep 28, 2011
ZuseZ4 pushed a commit to EnzymeAD/rust that referenced this issue Mar 7, 2023
coastalwhite pushed a commit to coastalwhite/rust that referenced this issue Aug 5, 2023
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
* Documentation: Updates for "Failures that Kani can spot"

* Remove "future work"

* Address comments - Restore "Limitations"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-type-system Area: Type system
Projects
None yet
Development

No branches or pull requests

1 participant