add a comment about the drop order for EncodedMetadata

This commit is contained in:
Yoshiki Matsuda 2022-05-30 00:49:26 +09:00
parent 03de5c4a14
commit ec64b4c90e

View File

@ -2144,6 +2144,7 @@ fn prefetch_mir(tcx: TyCtxt<'_>) {
// generated regardless of trailing bytes that end up in it. // generated regardless of trailing bytes that end up in it.
pub struct EncodedMetadata { pub struct EncodedMetadata {
// The declaration order matters because `mmap` should be dropped before `_temp_dir`.
mmap: Option<Mmap>, mmap: Option<Mmap>,
// We need to carry MaybeTempDir to avoid deleting the temporary // We need to carry MaybeTempDir to avoid deleting the temporary
// directory while accessing the Mmap. // directory while accessing the Mmap.