Auto merge of #90535 - tmiasko:clone-from, r=oli-obk
Implement `clone_from` for `State` Data flow engine uses `clone_from` for domain values. Providing an implementation of `clone_from` will avoid some intermediate memory allocations. Extracted from #90413. r? `@oli-obk`
This commit is contained in:
commit
50f2c29200
1 changed files with 14 additions and 1 deletions
|
@ -264,7 +264,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub(super) struct State {
|
pub(super) struct State {
|
||||||
/// Describes whether a local contains qualif.
|
/// Describes whether a local contains qualif.
|
||||||
pub qualif: BitSet<Local>,
|
pub qualif: BitSet<Local>,
|
||||||
|
@ -273,6 +273,19 @@ pub(super) struct State {
|
||||||
pub borrow: BitSet<Local>,
|
pub borrow: BitSet<Local>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Clone for State {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
State { qualif: self.qualif.clone(), borrow: self.borrow.clone() }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Data flow engine when possible uses `clone_from` for domain values.
|
||||||
|
// Providing an implementation will avoid some intermediate memory allocations.
|
||||||
|
fn clone_from(&mut self, other: &Self) {
|
||||||
|
self.qualif.clone_from(&other.qualif);
|
||||||
|
self.borrow.clone_from(&other.borrow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl State {
|
impl State {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub(super) fn contains(&self, local: Local) -> bool {
|
pub(super) fn contains(&self, local: Local) -> bool {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue