Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion compiler/rustc_const_eval/src/transform/check_consts/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ where
}
}

#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Debug, PartialEq, Eq)]
pub(super) struct State {
/// Describes whether a local contains qualif.
pub qualif: BitSet<Local>,
Expand All @@ -265,6 +265,19 @@ pub(super) struct State {
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 {
#[inline]
pub(super) fn contains(&self, local: Local) -> bool {
Expand Down