|
5 | 5 | #![feature(get_mut_unchecked)] |
6 | 6 |
|
7 | 7 | use std::{ |
8 | | - collections::HashMap, mem::zeroed, process, sync::LazyLock, time::{Duration, Instant} |
| 8 | + collections::HashMap, process, sync::LazyLock, time::{Duration, Instant} |
9 | 9 | }; |
10 | 10 |
|
11 | 11 | pub use paste::paste; |
@@ -74,7 +74,7 @@ pub struct Application<'a> { |
74 | 74 | code: HashMap<String, String>, |
75 | 75 | pub(crate) pkg: LanguagePackages<'a>, |
76 | 76 | entry: &'a str, |
77 | | - heap: Heap, |
| 77 | + heap: Option<Heap>, |
78 | 78 |
|
79 | 79 | // Resolve files |
80 | 80 | module_resolver: Box<dyn FnMut(&str) -> Vec<u8>>, |
@@ -107,10 +107,7 @@ impl<'a> Application<'a> { |
107 | 107 | Self { |
108 | 108 | code, |
109 | 109 | pkg: LanguagePackages::new(), |
110 | | - // SAFETY: It is Initialized before being used |
111 | | - // Basically its me being lazy & Wanting to reduce computation time |
112 | | - #[allow(invalid_value)] |
113 | | - heap: unsafe { zeroed() }, |
| 110 | + heap: None, |
114 | 111 | entry: &file, |
115 | 112 | module_resolver: Box::new(fs_resolver), |
116 | 113 | pkg_resolver: Box::new(dll_resolver), |
@@ -174,7 +171,7 @@ impl<'a> Application<'a> { |
174 | 171 | } |
175 | 172 |
|
176 | 173 | pub fn run(mut self, time: bool) -> ! { |
177 | | - self.heap = Heap::new(self.pkg.extends.clone()); |
| 174 | + self.heap = Some(Heap::new(self.pkg.extends.clone())); |
178 | 175 | let dur = self.run_non(); |
179 | 176 |
|
180 | 177 | if time { |
|
0 commit comments