Git dependencies, skip dropping ServeSession

This commit is contained in:
Lucien Greathouse
2022-05-27 19:39:44 -04:00
parent 85f113fcad
commit 86875ab5f2
3 changed files with 26 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
use std::{
io::{BufWriter, Write},
mem::ManuallyDrop,
path::{Path, PathBuf},
};
@@ -61,6 +62,14 @@ impl BuildCommand {
}
}
// Never drop ServeSession, because it's VERY expensive to drop and
// we're about to exit anyways.
//
// This is kind of evil; if this function is ever called outside of the
// context of a CLI, this will leak a large object forever. However, the
// performance benefits of leaking it outweigh the cost at this time.
let _session = ManuallyDrop::new(session);
Ok(())
}
}