Skip to content

Commit a857ba2

Browse files
committed
address review comments
Move tests and limit the init mask's structures/fields visibility.
1 parent 9f16a81 commit a857ba2

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

compiler/rustc_middle/src/mir/interpret/allocation.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
33
mod init_mask;
44
mod provenance_map;
5-
#[cfg(test)]
6-
mod tests;
75

86
use std::borrow::Cow;
97
use std::fmt;

compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#[cfg(test)]
2+
mod tests;
3+
14
use std::hash;
25
use std::iter;
36
use std::ops::Range;
@@ -16,12 +19,12 @@ type Block = u64;
1619
/// value.
1720
#[derive(Clone, Debug, Eq, PartialEq, TyEncodable, TyDecodable, Hash, HashStable)]
1821
pub struct InitMask {
19-
pub(crate) blocks: InitMaskBlocks,
22+
blocks: InitMaskBlocks,
2023
len: Size,
2124
}
2225

2326
#[derive(Clone, Debug, Eq, PartialEq, TyEncodable, TyDecodable, Hash, HashStable)]
24-
pub(crate) enum InitMaskBlocks {
27+
enum InitMaskBlocks {
2528
Lazy {
2629
/// Whether the lazy init mask is fully initialized or uninitialized.
2730
state: bool,
@@ -180,8 +183,8 @@ impl InitMask {
180183
// Note: for performance reasons when interning, some of the fields can be partially
181184
// hashed. (see the `Hash` impl below for more details), so the impl is not derived.
182185
#[derive(Clone, Debug, Eq, PartialEq, TyEncodable, TyDecodable, HashStable)]
183-
pub(crate) struct InitMaskMaterialized {
184-
pub(crate) blocks: Vec<Block>,
186+
struct InitMaskMaterialized {
187+
blocks: Vec<Block>,
185188
}
186189

187190
// Const allocations are only hashed for interning. However, they can be large, making the hashing

compiler/rustc_middle/src/mir/interpret/allocation/tests.rs renamed to compiler/rustc_middle/src/mir/interpret/allocation/init_mask/tests.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use super::*;
2+
use crate::mir::interpret::alloc_range;
23

34
#[test]
45
fn uninit_mask() {

0 commit comments

Comments
 (0)