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> {
|
fn remove_net(&mut self, net_id: NetId) -> Option<NetInfo> {
|
||||||
if let Some((net, rename)) = self.nets.remove(net_id.0) {
|
if let Some((net, rename)) = self.nets.remove(net_id.0) {
|
||||||
// Rename all the references to the net that was moved into this position.
|
if rename.src != rename.dest {
|
||||||
let renamed = self.nets.get(rename.dest).unwrap();
|
// Rename all the references to the net that was moved into this position.
|
||||||
for wire_id in &renamed.wires {
|
let renamed = self.nets.get(rename.dest).unwrap();
|
||||||
self.wires.get_mut(wire_id.0).unwrap().net_id = NetId(rename.dest);
|
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() {
|
//TODO remove this clone, reduce size of get_peg_mut borrow
|
||||||
self.get_peg_mut(peg_id).unwrap().net_id = NetId(rename.dest);
|
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:
|
// Perform the same swap-remove in net_states:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue