fix panic when dense store rename src==dest
This commit is contained in:
parent
a0948315be
commit
af421f97dd
1 changed files with 10 additions and 8 deletions
|
|
@ -327,14 +327,16 @@ impl Sandbox {
|
|||
|
||||
fn remove_net(&mut self, net_id: NetId) -> Option<NetInfo> {
|
||||
if let Some((net, rename)) = self.nets.remove(net_id.0) {
|
||||
// Rename all the references to the net that was moved into this position.
|
||||
let renamed = self.nets.get(rename.dest).unwrap();
|
||||
for wire_id in &renamed.wires {
|
||||
self.wires.get_mut(wire_id.0).unwrap().net_id = NetId(rename.dest);
|
||||
}
|
||||
//TODO remove this clone, reduce size of get_peg_mut borrow
|
||||
for peg_id in &renamed.pegs.clone() {
|
||||
self.get_peg_mut(peg_id).unwrap().net_id = NetId(rename.dest);
|
||||
if rename.src != rename.dest {
|
||||
// Rename all the references to the net that was moved into this position.
|
||||
let renamed = self.nets.get(rename.dest).unwrap();
|
||||
for wire_id in &renamed.wires {
|
||||
self.wires.get_mut(wire_id.0).unwrap().net_id = NetId(rename.dest);
|
||||
}
|
||||
//TODO remove this clone, reduce size of get_peg_mut borrow
|
||||
for peg_id in &renamed.pegs.clone() {
|
||||
self.get_peg_mut(peg_id).unwrap().net_id = NetId(rename.dest);
|
||||
}
|
||||
}
|
||||
|
||||
// Perform the same swap-remove in net_states:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue