Skip to content

fix(riscv): function_casts_as_integer#17

Closed
mkroening wants to merge 1 commit into
rcore-os:masterfrom
hermit-os:riscv-function_casts_as_integer
Closed

fix(riscv): function_casts_as_integer#17
mkroening wants to merge 1 commit into
rcore-os:masterfrom
hermit-os:riscv-function_casts_as_integer

Conversation

@mkroening

Copy link
Copy Markdown
Contributor
$ cargo build --target riscv64gc-unknown-none-elf
   Compiling trapframe v0.10.1 (/Users/mkroening/devel/trapframe-rs)
error: direct cast of function item into an integer
  --> src/arch/riscv/trap.rs:44:47
   |
44 |     asm!("csrw stvec, {}", in(reg) trap_entry as usize);
   |                                               ^^^^^^^^
   |
note: the lint level is defined here
  --> src/lib.rs:3:9
   |
 3 | #![deny(warnings)]
   |         ^^^^^^^^
   = note: `#[deny(function_casts_as_integer)]` implied by `#[deny(warnings)]`
help: first cast to a pointer `as *const ()`
   |
44 |     asm!("csrw stvec, {}", in(reg) trap_entry as *const () as usize);
   |                                               ++++++++++++

error: could not compile `trapframe` (lib) due to 1 previous error

```console
$ cargo build --target riscv64gc-unknown-none-elf
   Compiling trapframe v0.10.1 (/Users/mkroening/devel/trapframe-rs)
error: direct cast of function item into an integer
  --> src/arch/riscv/trap.rs:44:47
   |
44 |     asm!("csrw stvec, {}", in(reg) trap_entry as usize);
   |                                               ^^^^^^^^
   |
note: the lint level is defined here
  --> src/lib.rs:3:9
   |
 3 | #![deny(warnings)]
   |         ^^^^^^^^
   = note: `#[deny(function_casts_as_integer)]` implied by `#[deny(warnings)]`
help: first cast to a pointer `as *const ()`
   |
44 |     asm!("csrw stvec, {}", in(reg) trap_entry as *const () as usize);
   |                                               ++++++++++++

error: could not compile `trapframe` (lib) due to 1 previous error
```
@jiegec

jiegec commented Jul 4, 2026

Copy link
Copy Markdown
Member

Done in #19.

@jiegec jiegec closed this Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants