Skip to content

Unconstrained region variables when making str-ptr-ptr hash and eq #3283

Closed
@pcwalton

Description

@pcwalton

Test case:

pure fn view_hash(s: & &str) -> uint {
    hash::hash_str(*s) as uint
}

pure fn view_eq(a: & &str, b: & &str) -> bool {
    str::eq_slice(*a, *b)
}

fn main() {
    let map = send_map::linear::linear_map(view_hash, view_eq);
    map.insert("foo", ());
}

Errors:

/home/pcwalton/Source/rust/build/test.rs:11:58: 11:65 error: Unconstrained region variable #3
/home/pcwalton/Source/rust/build/test.rs:11         let map = send_map::linear::linear_map(view_hash, view_eq);
                                                                                                      ^~~~~~~
/home/pcwalton/Source/rust/build/test.rs:11:58: 11:65 error: Unconstrained region variable #4
/home/pcwalton/Source/rust/build/test.rs:11         let map = send_map::linear::linear_map(view_hash, view_eq);

If the functions become inline lambdas, the problem goes away.

@nikomatsakis, any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lifetimesArea: Lifetimes / regions

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions