Skip to content

Commit 645a281

Browse files
Rollup merge of #164089 - TaKO8Ki:borrowck-domain-clone-from, r=mati865
Implement `clone_from` for `BorrowckDomain` I've added a similar implementation for `BorrowckDomain` as for `rustc_const_eval::check_consts::resolver::State`. https://github.com/rust-lang/rust/blob/208a58d8c1b22a5b43c8e671077ed5ac4032abde/compiler/rustc_const_eval/src/check_consts/resolver.rs#L270-L281
2 parents 6dc7dd5 + 208a58d commit 645a281

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

‎compiler/rustc_borrowck/src/dataflow.rs‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,29 @@ impl JoinSemiLattice for BorrowckDomain {
103103
}
104104

105105
/// The transient state of the dataflow analyses used by the borrow checker.
106-
#[derive(Clone, Debug, PartialEq, Eq)]
106+
#[derive(Debug, PartialEq, Eq)]
107107
pub(crate) struct BorrowckDomain {
108108
pub(crate) borrows: BorrowsDomain,
109109
pub(crate) uninits: MaybeUninitializedPlacesDomain,
110110
pub(crate) ever_inits: EverInitializedPlacesDomain,
111111
}
112112

113+
impl Clone for BorrowckDomain {
114+
fn clone(&self) -> Self {
115+
Self {
116+
borrows: self.borrows.clone(),
117+
uninits: self.uninits.clone(),
118+
ever_inits: self.ever_inits.clone(),
119+
}
120+
}
121+
122+
fn clone_from(&mut self, source: &Self) {
123+
self.borrows.clone_from(&source.borrows);
124+
self.uninits.clone_from(&source.uninits);
125+
self.ever_inits.clone_from(&source.ever_inits);
126+
}
127+
}
128+
113129
rustc_index::newtype_index! {
114130
#[orderable]
115131
#[debug_format = "bw{}"]

0 commit comments

Comments
 (0)