From 981c9d07a40166460bd500878005099c024c76b8 Mon Sep 17 00:00:00 2001 From: Brooks Prumo Date: Thu, 6 Oct 2022 16:17:32 -0400 Subject: [PATCH] Rearranges eah TestEnvironment fields to ensure drop order (#28270) --- core/tests/epoch_accounts_hash.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/tests/epoch_accounts_hash.rs b/core/tests/epoch_accounts_hash.rs index 2177ae701d..a170b891f9 100755 --- a/core/tests/epoch_accounts_hash.rs +++ b/core/tests/epoch_accounts_hash.rs @@ -42,16 +42,17 @@ use { }; struct TestEnvironment { + /// NOTE: The fields are arranged to ensure they are dropped in the correct order. + /// - BankForks must be dropped before BackgroundServices + /// - BackgroundServices must be dropped before the TempDirs + /// - SnapshotConfig should be dropped before the TempDirs bank_forks: Arc>, - + background_services: BackgroundServices, genesis_config_info: GenesisConfigInfo, + _snapshot_config: SnapshotConfig, _bank_snapshots_dir: TempDir, _full_snapshot_archives_dir: TempDir, _incremental_snapshot_archives_dir: TempDir, - _snapshot_config: SnapshotConfig, - - // NOTE: This field must come after bank_forks because it must be dropped after - background_services: BackgroundServices, } impl TestEnvironment {