Closed
Description
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.
Metadata
Metadata
Assignees
Labels
No labels