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

Segfault with hashmap, boxes and pattern matching #4904

Closed
brson opened this issue Feb 12, 2013 · 4 comments
Closed

Segfault with hashmap, boxes and pattern matching #4904

brson opened this issue Feb 12, 2013 · 4 comments
Labels
A-codegen Area: Code generation A-lifetimes Area: lifetime related I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Milestone

Comments

@brson
Copy link
Contributor

brson commented Feb 12, 2013

This segfaults.

extern mod std;

use std::oldmap::HashMap;

fn main() {
    let wait_map = HashMap::<int, @mut ~[int]>();
    match wait_map.find(&1) {
        Some(@ref mut waiters) => { }
        None => ()
    }
}
@catamorphism
Copy link
Contributor

Reproduced. I'll take a stab at it.

@ghost ghost assigned catamorphism Mar 25, 2013
@catamorphism
Copy link
Contributor

Hmm, I'm not sure if this should even be legal (that is, whether it should be accepted by borrowck). And, the failure (which also happens when i change the pattern from ref mut to just ref) is a null-dereference in return_to_mut. I think I may be a bit out of my depth here.

@nikomatsakis
Copy link
Contributor

I think this should be legal. Presumably we are failing to root the managed box or something like that, I'm not sure what this function return_to_mut is.

@catamorphism
Copy link
Contributor

Fixed, just need to add the test case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation A-lifetimes Area: lifetime related 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