From 629e395e171e326624a5de98667a28b9e019ad7d Mon Sep 17 00:00:00 2001 From: Devin Jean Date: Tue, 14 Nov 2023 08:44:21 -0600 Subject: [PATCH] check locals borrows --- Cargo.toml | 2 +- src/process.rs | 2 +- src/std_system.rs | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 78a24b0..c87c008 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "netsblox-vm" -version = "0.2.19" +version = "0.2.20" edition = "2021" license = "MIT OR Apache-2.0" authors = ["Devin Jean "] diff --git a/src/process.rs b/src/process.rs index 51293d2..4b588af 100644 --- a/src/process.rs +++ b/src/process.rs @@ -257,7 +257,7 @@ impl<'gc, C: CustomTypes, S: System> Process<'gc, C, S> { /// /// The process transitions to the idle state (see [`Process::is_running`]) upon failing with [`Err`] or succeeding with [`ProcessStep::Terminate`]. /// - /// This function is not re-entrant, so calling it from the mutable handle of, e.g., [`Config`] will likely lead to panics. + /// This function is not re-entrant, so recursively calling it from the mutable handle of, e.g., [`Config`] will likely lead to panics. pub fn step(&mut self, mc: &Mutation<'gc>) -> Result, ExecError> { if !self.is_running() { return Ok(ProcessStep::Idle); diff --git a/src/std_system.rs b/src/std_system.rs index adee8cf..b704c00 100644 --- a/src/std_system.rs +++ b/src/std_system.rs @@ -405,7 +405,7 @@ impl>> StdSystem { #[cfg(debug_assertions)] fn check_runtime_borrows<'gc>(mc: &Mutation<'gc>, proc: &mut Process<'gc, C, Self>) { - fn check_symbols<'gc, C: CustomTypes>>(mc: &Mutation<'gc>, symbols: &mut SymbolTable<'gc, C, StdSystem>) { + fn check_symbols<'gc, C: CustomTypes>>(mc: &Mutation<'gc>, symbols: &SymbolTable<'gc, C, StdSystem>) { for symbol in symbols { match &*symbol.1.get() { Value::Bool(_) | Value::Number(_) | Value::String(_) | Value::Audio(_) | Value::Image(_) | Value::Native(_) => (), @@ -416,15 +416,16 @@ impl>> StdSystem { } } fn check_entity<'gc, C: CustomTypes>>(mc: &Mutation<'gc>, entity: &mut Entity<'gc, C, StdSystem>) { - check_symbols(mc, &mut entity.fields); + check_symbols(mc, &entity.fields); if let Some(original) = entity.original { check_entity(mc, &mut *original.borrow_mut(mc)); } } - let mut global_context = proc.global_context.borrow_mut(mc); - check_symbols(mc, &mut global_context.globals); + let global_context = proc.global_context.borrow_mut(mc); + check_symbols(mc, &global_context.globals); for entry in proc.get_call_stack() { + check_symbols(mc, &entry.locals); check_entity(mc, &mut entry.entity.borrow_mut(mc)); } for entity in global_context.entities.iter() {