Skip to content

Commit 64ddd51

Browse files
committed
YJIT: Fix warn(unused_assignments) in test_gen_opt_reverse
Previously: ``` warning: value assigned to `value_array` is never read --> yjit/src/codegen.rs:11446:9 | 11446 | value_array[1] = 4; | ^^^^^^^^^^^^^^^^^^ | = help: maybe it is overwritten before being read? = note: `#[warn(unused_assignments)]` (part of `#[warn(unused)]`) on by default ``` It can't see the alias through `jit.pc`!
1 parent 07490d1 commit 64ddd51

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

yjit/src/codegen.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11429,9 +11429,8 @@ mod tests {
1142911429
asm.stack_push(Type::Flonum);
1143011430
asm.stack_push(Type::CString);
1143111431

11432-
let mut value_array: [u64; 2] = [0, 3];
11433-
let pc: *mut VALUE = &mut value_array as *mut u64 as *mut VALUE;
11434-
jit.pc = pc;
11432+
let mut fake_encoded_iseq: [VALUE; 2] = [VALUE(0), VALUE(3)];
11433+
jit.pc = &mut fake_encoded_iseq[0];
1143511434

1143611435
let mut status = gen_opt_reverse(&mut jit, &mut asm);
1143711436

@@ -11442,8 +11441,9 @@ mod tests {
1144211441
assert_eq!(Type::Fixnum, asm.ctx.get_opnd_type(StackOpnd(0)));
1144311442

1144411443
// Try again with an even number of elements.
11444+
fake_encoded_iseq[1] = VALUE(4);
11445+
let _ = fake_encoded_iseq;
1144511446
asm.stack_push(Type::Nil);
11446-
value_array[1] = 4;
1144711447
status = gen_opt_reverse(&mut jit, &mut asm);
1144811448

1144911449
assert_eq!(status, Some(KeepCompiling));

0 commit comments

Comments
 (0)