You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm looking at this. A tricky thing is that HashMap::consume empties the hashmap by mutable reference, while the consume iter takes it by value. Both alternatives have use cases.
This is problematic in librusti, which uses @mut HashMap and empties them with do map.consume ...
The workaround ends up looking like this:
@@ -163,7 +164,8 @@ impl Program {
None => {}
}
- do self.newvars.consume |name, var| {
+ let newvars = util::replace(&mut self.newvars, HashMap::new());
+ for newvars.consume_iter().advance |(name, var)| {
self.local_vars.insert(name, var);
}
Activity
HashMap
andHashSet
#7806auto merge of #7806 : apasel422/rust/hash_consume, r=catamorphism
bluss commentedon Jul 16, 2013
I'm looking at this. A tricky thing is that HashMap::consume empties the hashmap by mutable reference, while the consume iter takes it by value. Both alternatives have use cases.
This is problematic in librusti, which uses
@mut HashMap
and empties them withdo map.consume ...
The workaround ends up looking like this:
Not sure if this is acceptable.
auto merge of #7833 : blake2-ppc/rust/hashmap-consume, r=alexcrichton
bluss commentedon Jul 22, 2013
is fixed
huonw commentedon Jul 22, 2013
Fixed by #7833.