MSxDOS/ntapi

ntapi 0.3.7 contains code that will be incompatible with future versions of Rust

Closed this issue · 0 comments

Hi there!

Compiling ntapi (downstream dependency of one of my dependencies) with today (2022-08-06)'s nightly compiler results in the following warning:
warning: the following packages contain code that will be rejected by a future version of Rust: ntapi v0.3.7

The resulting cargo report looks like this:

The package `ntapi v0.3.7` currently triggers the following future incompatibility lints:
> warning: reference to packed field is unaligned
>     --> .cargo\registry\src\github.com-1ecc6299db9ec823\ntapi-0.3.7\src\ntexapi.rs:2783:52
>      |
> 2783 |         *tick_count.QuadPart_mut() = read_volatile(&(*USER_SHARED_DATA).u.TickCountQuad);
>      |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>      |
>      = note: `#[allow(unaligned_references)]` on by default
>      = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
>      = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
>      = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
>      = 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 pointers)
>
> warning: reference to packed field is unaligned
>     --> .cargo\registry\src\github.com-1ecc6299db9ec823\ntapi-0.3.7\src\ntexapi.rs:2807:25
>      |
> 2807 |         ((read_volatile(&(*USER_SHARED_DATA).u.TickCountQuad)
>      |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>      |
>      = note: `#[allow(unaligned_references)]` on by default
>      = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
>      = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
>      = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
>      = 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 pointers)

Hoping this isn't too troublesome to fix 🙏