Skip to content

Commit d8b01c7

Browse files
committed
fix function_casts_as_integer lint
1 parent 77f2e03 commit d8b01c7

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

src/tools/miri/src/shims/native_lib/trace/parent.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -500,9 +500,8 @@ fn handle_segfault(
500500
capstone_disassemble(&instr, addr, cs, acc_events).expect("Failed to disassemble instruction");
501501

502502
// Move the instr ptr into the deprotection code.
503-
#[allow(unknown_lints)]
504-
#[expect(clippy::as_conversions, function_casts_as_integer)]
505-
new_regs.set_ip(mempr_off as usize);
503+
#[expect(clippy::as_conversions)]
504+
new_regs.set_ip(mempr_off as *const () as usize);
506505
// Don't mess up the stack by accident!
507506
new_regs.set_sp(stack_ptr);
508507

@@ -553,9 +552,8 @@ fn handle_segfault(
553552
new_regs = regs_bak;
554553

555554
// Reprotect everything and continue.
556-
#[allow(unknown_lints)]
557-
#[expect(clippy::as_conversions, function_casts_as_integer)]
558-
new_regs.set_ip(mempr_on as usize);
555+
#[expect(clippy::as_conversions)]
556+
new_regs.set_ip(mempr_on as *const () as usize);
559557
new_regs.set_sp(stack_ptr);
560558
ptrace::setregs(pid, new_regs).unwrap();
561559
wait_for_signal(Some(pid), signal::SIGSTOP, InitialCont::Yes)?;

src/tools/miri/tests/pass/backtrace/backtrace-api-v1.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@normalize-stderr-test: "::<.*>" -> ""
22

3-
#![allow(function_casts_as_integer)]
4-
53
#[inline(never)]
64
fn func_a() -> Box<[*mut ()]> {
75
func_b::<u8>()
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
tests/pass/backtrace/backtrace-api-v1.rs:29:9 (func_d)
2-
tests/pass/backtrace/backtrace-api-v1.rs:16:9 (func_c)
3-
tests/pass/backtrace/backtrace-api-v1.rs:11:5 (func_b::<u8>)
4-
tests/pass/backtrace/backtrace-api-v1.rs:7:5 (func_a)
5-
tests/pass/backtrace/backtrace-api-v1.rs:36:18 (main)
1+
tests/pass/backtrace/backtrace-api-v1.rs:27:9 (func_d)
2+
tests/pass/backtrace/backtrace-api-v1.rs:14:9 (func_c)
3+
tests/pass/backtrace/backtrace-api-v1.rs:9:5 (func_b::<u8>)
4+
tests/pass/backtrace/backtrace-api-v1.rs:5:5 (func_a)
5+
tests/pass/backtrace/backtrace-api-v1.rs:34:18 (main)

0 commit comments

Comments
 (0)