Add a comment explaining the static "local" during deallocate_local
This commit is contained in:
parent
2e562a4d64
commit
45ab975610
1 changed files with 4 additions and 1 deletions
|
|
@ -414,7 +414,10 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
|||
let ptr = ptr.to_ptr()?;
|
||||
self.memory.dump_alloc(ptr.alloc_id);
|
||||
match self.memory.get(ptr.alloc_id)?.kind {
|
||||
::memory::Kind::Static | ::memory::Kind::UninitializedStatic => {},
|
||||
// for a constant like `const FOO: &i32 = &1;` the local containing
|
||||
// the `1` is referred to by the global. We transitively marked everything
|
||||
// the global refers to as static itself, so we don't free it here
|
||||
::memory::Kind::Static => {}
|
||||
::memory::Kind::Stack => self.memory.deallocate(ptr, None, ::memory::Kind::Stack)?,
|
||||
other => bug!("local contained non-stack memory: {:?}", other),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue