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

"the type of this value must be known in this context" reoccurring #5687

Closed
lifthrasiir opened this issue Apr 3, 2013 · 1 comment
Closed

Comments

@lifthrasiir
Copy link
Contributor

Regarding #2429, I have observed the same error occurring in the recent incoming (5f13e9c 2013-04-02 13:36:51 -0700):

use core::hashmap::linear::LinearMap;
fn main() {
    let mut map = LinearMap::new();
    let set_default = |k: int, v: int| {
        // N.B. we can't use match here due to the other bug #4666
        let insert =
            match map.find_mut(&k) {
                Some(vs) => { /*let vs: &mut ~[int] = vs;*/ vs.push(v); false }
                None => true
            };
        if insert { map.insert(k, ~[v]); }
    };
    set_default(1, 2);
    set_default(2, 3);
    set_default(1, 4);
    for map.each |&(&k, &v)| { io::println(fmt!("%? -> %?", k, v)); }
}

...resulting in:

t.rs:6:24: 6:26 error: the type of this value must be known in this context
t.rs:6             Some(vs) => vs.push(v),
                               ^~

It compiles (and works) correctly if we uncomment let vs: ... = vs; part.

@lifthrasiir
Copy link
Contributor Author

Uh, I realized that the original bug refers to "duplicate errors", not an occurrence of the error itself. Marking this issue invalid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant