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

ARC needs to enforce that its parameter is in the const kind #2458

Closed
erickt opened this issue May 27, 2012 · 3 comments
Closed

ARC needs to enforce that its parameter is in the const kind #2458

erickt opened this issue May 27, 2012 · 3 comments
Labels
A-type-system Area: Type system I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

Comments

@erickt
Copy link
Contributor

erickt commented May 27, 2012

use std;
import std::arc;

fn main() {
    let i = @5;
    let arc_i = arc::arc(i);

    task::spawn { ||
        let i = *arc::get(&arc_i);
        #error("%?", i);
    }
}

Errors with:

Unreclaimed object found at 0x100600040: 5
rust: "@5"
Assertion failed: (false && "live_allocs < 1"), function free, file /Users/etryzelaar/Projects/rust/rust/src/rt/memory_region.cpp, line 60.
@pcwalton
Copy link
Contributor

This is a symptom of the lack of const kind. You shouldn't be able to ARC a
task-local box.
On May 27, 2012 3:35 PM, "Erick Tryzelaar" <
reply@reply.github.com>
wrote:

use std;
import std::arc;

fn main() {
   let i = @5;
   let arc_i = arc::arc(i);

   task::spawn { ||
       let i = *arc::get(&arc_i);
       #error("%?", i);
   }
}

Errors with:

Unreclaimed object found at 0x100600040: 5
rust: "@5"
Assertion failed: (false && "live_allocs < 1"), function free, file
/Users/etryzelaar/Projects/rust/rust/src/rt/memory_region.cpp, line 60.

Reply to this email directly or view it on GitHub:
#2458

@eholk
Copy link
Contributor

eholk commented May 29, 2012

I actually have a const bounded arc in one of my local branches. I thought I pushed it to master, but I guess I forgot. I'll try to push it later today.

@eholk
Copy link
Contributor

eholk commented May 29, 2012

aa2efc0 adds the const kind bound to arc. It also adds a share_arc, which sadly doesn't work due to compiler bugs.

@eholk eholk closed this as completed May 29, 2012
bors added a commit to rust-lang-ci/rust that referenced this issue Sep 22, 2022
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 I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Projects
None yet
Development

No branches or pull requests

3 participants