Skip to content

segfault: alt allows uniqueness violation #2657

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
paulstansifer opened this issue Jun 20, 2012 · 5 comments
Closed

segfault: alt allows uniqueness violation #2657

paulstansifer opened this issue Jun 20, 2012 · 5 comments
Assignees
Labels
A-type-system Area: Type system
Milestone

Comments

@paulstansifer
Copy link
Contributor

We shouldn't be able to duplicate a reference to a unique value. But:

let x = some(~1);
alt x {
  some(y) {
    let a <- x;
    let b <- y;
    // disaster ensues, eventually, potentially, distantly
  }
}

The some() isn't even necessary.

@paulstansifer
Copy link
Contributor Author

This is thematically related to #2329.

@nikomatsakis
Copy link
Contributor

D'oh. This is my fault, liveness or borrowck should prevent moves from bindings---probably borrowck. In any case, this would go away if #2329 were implemented. But it'd be easy to fix in the meantime.

@nikomatsakis
Copy link
Contributor

Actually, I'm a bit surprised that this passes... I should look into this.

@nikomatsakis
Copy link
Contributor

Oh, right, the actual bug here is that borrowck doesn't understand let x <- v.

nikomatsakis added a commit that referenced this issue Jun 21, 2012
Related to issue #2657, but this is not a complete fix.
@ghost ghost assigned nikomatsakis Jun 21, 2012
@nikomatsakis
Copy link
Contributor

this should be fully fixed now.

nikomatsakis added a commit that referenced this issue Jun 21, 2012
RalfJung pushed a commit to RalfJung/rust that referenced this issue Nov 15, 2022
Add miri_alloc, miri_dealloc

`miri_alloc` and `miri_dealloc` are basically the same as `__rust_alloc` and `__rust_dealloc` respectively, but without the check for a global allocator.

This should allow bootstrapping an allocator in environments, where no fundamental way of allocating memory is available (`no_std` + `alloc` in Miri).
Aaron1011 pushed a commit to Aaron1011/rust that referenced this issue Jan 6, 2023
Add miri_alloc, miri_dealloc

`miri_alloc` and `miri_dealloc` are basically the same as `__rust_alloc` and `__rust_dealloc` respectively, but without the check for a global allocator.

This should allow bootstrapping an allocator in environments, where no fundamental way of allocating memory is available (`no_std` + `alloc` in Miri).
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
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

2 participants