diff --git a/src/cli.rs b/src/cli.rs index 7011315..584a4b7 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -265,7 +265,7 @@ fn run_proj_tty>>(project_name: &str, server: String for input in input_sequence.drain(..) { proj.input(mc, input); } for _ in 0..STEPS_PER_IO_ITER { let res = proj.step(mc); - if let ProjectStep::Error { error, proc } = &res { + if let ProjectStep::Error { error, proc: _ } = &res { print!("\r\n>>> runtime error: {:?}\r\n\r\n", error.cause); } idle_sleeper.consume(&res); @@ -325,7 +325,7 @@ fn run_proj_non_tty>>(project_name: &str, server: St let mut proj = env.proj.borrow_mut(mc); for _ in 0..STEPS_PER_IO_ITER { let res = proj.step(mc); - if let ProjectStep::Error { error, proc } = &res { + if let ProjectStep::Error { error, proc: _ } = &res { println!("\n>>> runtime error: {:?}\n", error.cause); } idle_sleeper.consume(&res); diff --git a/src/process.rs b/src/process.rs index f211ce4..f796ba9 100644 --- a/src/process.rs +++ b/src/process.rs @@ -78,7 +78,7 @@ impl ErrorSummary { } res } - let globals = summarize_symbols(&process.get_global_context().borrow().globals); + let globals = summarize_symbols(&process.global_context.borrow().globals); let fields = summarize_symbols(&raw_entity.borrow().fields); let mut trace = Vec::with_capacity(process.call_stack.len()); @@ -195,21 +195,21 @@ pub struct ProcContext<'gc, C: CustomTypes, S: System> { #[derive(Collect)] #[collect(no_drop, bound = "")] pub struct Process<'gc, C: CustomTypes, S: System> { - global_context: Gc<'gc, RefLock>>, - #[collect(require_static)] pos: usize, - #[collect(require_static)] running: bool, - #[collect(require_static)] barrier: Option, - #[collect(require_static)] reply_key: Option, - #[collect(require_static)] warp_counter: usize, - #[collect(require_static)] state: C::ProcessState, - call_stack: Vec>, - value_stack: Vec>, - #[collect(require_static)] handler_stack: Vec, - #[collect(require_static)] defer: Option>, - last_syscall_error: Option>, - last_rpc_error: Option>, - last_answer: Option>, - last_message: Option>, + pub global_context: Gc<'gc, RefLock>>, + #[collect(require_static)] pub state: C::ProcessState, + #[collect(require_static)] pos: usize, + #[collect(require_static)] running: bool, + #[collect(require_static)] barrier: Option, + #[collect(require_static)] reply_key: Option, + #[collect(require_static)] warp_counter: usize, + call_stack: Vec>, + value_stack: Vec>, + #[collect(require_static)] handler_stack: Vec, + #[collect(require_static)] defer: Option>, + last_syscall_error: Option>, + last_rpc_error: Option>, + last_answer: Option>, + last_message: Option>, } impl<'gc, C: CustomTypes, S: System> Process<'gc, C, S> { /// Creates a new [`Process`] with the given starting context. @@ -245,10 +245,6 @@ impl<'gc, C: CustomTypes, S: System> Process<'gc, C, S> { pub fn is_running(&self) -> bool { self.running } - /// Gets the global context that this process is tied to (see [`Process::new`]). - pub fn get_global_context(&self) -> Gc<'gc, RefLock>> { - self.global_context - } /// Executes a single bytecode instruction. /// The return value can be used to determine what additional effects the script has requested, /// as well as to retrieve the return value or execution error in the event that the process terminates. diff --git a/src/project.rs b/src/project.rs index f08a016..4ba3731 100644 --- a/src/project.rs +++ b/src/project.rs @@ -309,7 +309,7 @@ impl<'gc, C: CustomTypes, S: System> Project<'gc, C, S> { ProjectStep::Pause } ProcessStep::Fork { pos, locals, entity } => { - let mut proc = Process::new(ProcContext { global_context: self.state.global_context, entity, start_pos: pos, locals, barrier: None, reply_key: None, local_message: None }); + let proc = Process::new(ProcContext { global_context: self.state.global_context, entity, start_pos: pos, locals, barrier: None, reply_key: None, local_message: None }); let fork_proc_key = self.state.processes.insert(proc); all_contexts_consumer.do_once(self); // need to consume all contexts before scheduling things in the future