address review comments

Move tests and limit the init mask's structures/fields visibility.
This commit is contained in:
Rémy Rakic 2023-03-28 13:22:01 +00:00
parent 9f16a81bc8
commit a857ba25f9
3 changed files with 8 additions and 6 deletions

View file

@ -2,8 +2,6 @@
mod init_mask;
mod provenance_map;
#[cfg(test)]
mod tests;
use std::borrow::Cow;
use std::fmt;

View file

@ -1,3 +1,6 @@
#[cfg(test)]
mod tests;
use std::hash;
use std::iter;
use std::ops::Range;
@ -16,12 +19,12 @@
/// value.
#[derive(Clone, Debug, Eq, PartialEq, TyEncodable, TyDecodable, Hash, HashStable)]
pub struct InitMask {
pub(crate) blocks: InitMaskBlocks,
blocks: InitMaskBlocks,
len: Size,
}
#[derive(Clone, Debug, Eq, PartialEq, TyEncodable, TyDecodable, Hash, HashStable)]
pub(crate) enum InitMaskBlocks {
enum InitMaskBlocks {
Lazy {
/// Whether the lazy init mask is fully initialized or uninitialized.
state: bool,
@ -180,8 +183,8 @@ pub fn get(&self, idx: Size) -> bool {
// Note: for performance reasons when interning, some of the fields can be partially
// hashed. (see the `Hash` impl below for more details), so the impl is not derived.
#[derive(Clone, Debug, Eq, PartialEq, TyEncodable, TyDecodable, HashStable)]
pub(crate) struct InitMaskMaterialized {
pub(crate) blocks: Vec<Block>,
struct InitMaskMaterialized {
blocks: Vec<Block>,
}
// Const allocations are only hashed for interning. However, they can be large, making the hashing

View file

@ -1,4 +1,5 @@
use super::*;
use crate::mir::interpret::alloc_range;
#[test]
fn uninit_mask() {