Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dragazo committed Nov 11, 2023
1 parent 3faee30 commit 965fbb9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ fn run_proj_tty<C: CustomTypes<StdSystem<C>>>(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);
Expand Down Expand Up @@ -325,7 +325,7 @@ fn run_proj_non_tty<C: CustomTypes<StdSystem<C>>>(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);
Expand Down
36 changes: 16 additions & 20 deletions src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -195,21 +195,21 @@ pub struct ProcContext<'gc, C: CustomTypes<S>, S: System<C>> {
#[derive(Collect)]
#[collect(no_drop, bound = "")]
pub struct Process<'gc, C: CustomTypes<S>, S: System<C>> {
global_context: Gc<'gc, RefLock<GlobalContext<'gc, C, S>>>,
#[collect(require_static)] pos: usize,
#[collect(require_static)] running: bool,
#[collect(require_static)] barrier: Option<Barrier>,
#[collect(require_static)] reply_key: Option<S::InternReplyKey>,
#[collect(require_static)] warp_counter: usize,
#[collect(require_static)] state: C::ProcessState,
call_stack: Vec<CallStackEntry<'gc, C, S>>,
value_stack: Vec<Value<'gc, C, S>>,
#[collect(require_static)] handler_stack: Vec<Handler>,
#[collect(require_static)] defer: Option<Defer<C, S>>,
last_syscall_error: Option<Value<'gc, C, S>>,
last_rpc_error: Option<Value<'gc, C, S>>,
last_answer: Option<Value<'gc, C, S>>,
last_message: Option<Value<'gc, C, S>>,
pub global_context: Gc<'gc, RefLock<GlobalContext<'gc, C, S>>>,
#[collect(require_static)] pub state: C::ProcessState,
#[collect(require_static)] pos: usize,
#[collect(require_static)] running: bool,
#[collect(require_static)] barrier: Option<Barrier>,
#[collect(require_static)] reply_key: Option<S::InternReplyKey>,
#[collect(require_static)] warp_counter: usize,
call_stack: Vec<CallStackEntry<'gc, C, S>>,
value_stack: Vec<Value<'gc, C, S>>,
#[collect(require_static)] handler_stack: Vec<Handler>,
#[collect(require_static)] defer: Option<Defer<C, S>>,
last_syscall_error: Option<Value<'gc, C, S>>,
last_rpc_error: Option<Value<'gc, C, S>>,
last_answer: Option<Value<'gc, C, S>>,
last_message: Option<Value<'gc, C, S>>,
}
impl<'gc, C: CustomTypes<S>, S: System<C>> Process<'gc, C, S> {
/// Creates a new [`Process`] with the given starting context.
Expand Down Expand Up @@ -245,10 +245,6 @@ impl<'gc, C: CustomTypes<S>, S: System<C>> 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<GlobalContext<'gc, C, S>>> {
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.
Expand Down
2 changes: 1 addition & 1 deletion src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ impl<'gc, C: CustomTypes<S>, S: System<C>> 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
Expand Down

0 comments on commit 965fbb9

Please sign in to comment.