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

Comments

Projects
None yet
3 participants
@brson
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

This comment has been minimized.

Show comment
Hide comment
@catamorphism

catamorphism Mar 25, 2013

Contributor

Reproduced. I'll take a stab at it.

Contributor

catamorphism commented Mar 25, 2013

Reproduced. I'll take a stab at it.

@ghost ghost assigned catamorphism Mar 25, 2013

@catamorphism

This comment has been minimized.

Show comment
Hide comment
@catamorphism

catamorphism Mar 25, 2013

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.

Contributor

catamorphism commented Mar 25, 2013

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

This comment has been minimized.

Show comment
Hide comment
@nikomatsakis

nikomatsakis Mar 26, 2013

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.

Contributor

nikomatsakis commented Mar 26, 2013

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

This comment has been minimized.

Show comment
Hide comment
@catamorphism

catamorphism Mar 26, 2013

Contributor

Fixed, just need to add the test case

Contributor

catamorphism commented Mar 26, 2013

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