File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -249,8 +249,16 @@ impl HeapPool {
249249 self . usage ( ) >= self . gc_threshold || self . alloc_count >= 1024
250250 }
251251
252- #[ inline( always) ] pub fn get ( & self , v : Val ) -> & HeapObj { self . objects [ v. as_heap ( ) as usize ] . as_ref ( ) . unwrap ( ) }
253- #[ inline( always) ] pub fn get_mut ( & mut self , v : Val ) -> & mut HeapObj { self . objects [ v. as_heap ( ) as usize ] . as_mut ( ) . unwrap ( ) }
252+ #[ inline( always) ] pub fn get ( & self , v : Val ) -> & HeapObj {
253+ self . objects [ v. as_heap ( ) as usize ]
254+ . as_ref ( )
255+ . expect ( "garbage collector invariant violated: live Val references a freed heap slot" )
256+ }
257+ #[ inline( always) ] pub fn get_mut ( & mut self , v : Val ) -> & mut HeapObj {
258+ self . objects [ v. as_heap ( ) as usize ]
259+ . as_mut ( )
260+ . expect ( "garbage collector invariant violated: live Val references a freed heap slot (mut)" )
261+ }
254262 pub fn usage ( & self ) -> usize { self . objects . len ( ) - self . free_list . len ( ) }
255263
256264 #[ inline( always) ]
You can’t perform that action at this time.
0 commit comments