mirror of
https://github.com/YosysHQ/nextpnr.git
synced 2026-01-13 15:27:37 +00:00
awooter: fix an API soundness issue
This commit is contained in:
parent
2662354aae
commit
d27bcbf19e
@ -54,7 +54,14 @@ pub struct PortRef {
|
||||
}
|
||||
|
||||
impl PortRef {
|
||||
pub fn cell(&self) -> Option<&mut CellInfo> {
|
||||
pub fn cell(&self) -> Option<&CellInfo> {
|
||||
// SAFETY: handing out &s is safe when we have &self.
|
||||
unsafe { npnr_portref_cell(self).as_ref() }
|
||||
}
|
||||
|
||||
pub fn cell_mut(&mut self) -> Option<&mut CellInfo> {
|
||||
// SAFETY: handing out &mut is safe when we have &mut self
|
||||
// as getting multiple &mut CellInfo would require multiple &mut PortRef.
|
||||
unsafe { npnr_portref_cell(self).as_mut() }
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user