Skip to content

Commit 0a2f2d0

Browse files
committed
Handle both homogeneous and inhomogeneous clone_from.
1 parent 831f25f commit 0a2f2d0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

compiler/rustc_index/src/bit_set.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1078,8 +1078,12 @@ impl<T> Clone for BitSet<T> {
10781078
}
10791079

10801080
fn clone_from(&mut self, from: &Self) {
1081-
assert_eq!(self.domain_size, from.domain_size);
1082-
bitwise(&mut self.words, &from.words, |_, b| b);
1081+
if self.domain_size == from.domain_size {
1082+
bitwise(&mut self.words, &from.words, |_, b| b);
1083+
} else {
1084+
self.domain_size = from.domain_size;
1085+
self.words.clone_from(&from.words);
1086+
}
10831087
}
10841088
}
10851089

0 commit comments

Comments
 (0)