diff options
| author | Rémy Rakic <remy.rakic+github@gmail.com> | 2023-03-28 13:22:01 +0000 |
|---|---|---|
| committer | Rémy Rakic <remy.rakic+github@gmail.com> | 2023-03-28 13:22:01 +0000 |
| commit | a857ba25f9630032a34aba5dc45fd5f58351c7f0 (patch) | |
| tree | c7c07d6d8d50f9629df1c3063fba0d899bb7c7c0 | |
| parent | 9f16a81bc86e4b3c851abd58a4852e6dad7eb17e (diff) | |
| download | rust-a857ba25f9630032a34aba5dc45fd5f58351c7f0.tar.gz rust-a857ba25f9630032a34aba5dc45fd5f58351c7f0.zip | |
address review comments
Move tests and limit the init mask's structures/fields visibility.
| -rw-r--r-- | compiler/rustc_middle/src/mir/interpret/allocation.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs | 11 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/mir/interpret/allocation/init_mask/tests.rs (renamed from compiler/rustc_middle/src/mir/interpret/allocation/tests.rs) | 1 |
3 files changed, 8 insertions, 6 deletions
diff --git a/compiler/rustc_middle/src/mir/interpret/allocation.rs b/compiler/rustc_middle/src/mir/interpret/allocation.rs index 48375ed301d..2f2c7b15416 100644 --- a/compiler/rustc_middle/src/mir/interpret/allocation.rs +++ b/compiler/rustc_middle/src/mir/interpret/allocation.rs @@ -2,8 +2,6 @@ mod init_mask; mod provenance_map; -#[cfg(test)] -mod tests; use std::borrow::Cow; use std::fmt; diff --git a/compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs b/compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs index 312fecea5da..9a02bc0cc15 100644 --- a/compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs +++ b/compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs @@ -1,3 +1,6 @@ +#[cfg(test)] +mod tests; + use std::hash; use std::iter; use std::ops::Range; @@ -16,12 +19,12 @@ type Block = u64; /// 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 @@ impl InitMask { // 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 diff --git a/compiler/rustc_middle/src/mir/interpret/allocation/tests.rs b/compiler/rustc_middle/src/mir/interpret/allocation/init_mask/tests.rs index 171ed4d93bb..1a7934bc210 100644 --- a/compiler/rustc_middle/src/mir/interpret/allocation/tests.rs +++ b/compiler/rustc_middle/src/mir/interpret/allocation/init_mask/tests.rs @@ -1,4 +1,5 @@ use super::*; +use crate::mir::interpret::alloc_range; #[test] fn uninit_mask() { |
