小编Rod*_*tro的帖子

我的 Rust 项目突然坏了

所以我对我的代码做了一些更改,并尝试在我的工作计算机上编译它。我收到与 ntapi 包相关的以下错误:

\n
    error[E0793]: reference to packed field is unaligned\n    --> C:\\Users\\u\\.cargo\\registry\\src\\github.com-1eccb9ec823\\ntapi-0.3.6\\src\\ntexapi.rs:2785:52\n     |\n2785 |         *tick_count.QuadPart_mut() = read_volatile(&(*USER_SHARED_DATA).u.TickCountQuad);\n     |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n     |\n     = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)\n     = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw …
Run Code Online (Sandbox Code Playgroud)

rust rust-crates rust-cargo

3
推荐指数
1
解决办法
4653
查看次数

标签 统计

rust ×1

rust-cargo ×1

rust-crates ×1