Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Future incompatibilities detected in Device Path Protocol implementation #731

Closed
kennystrawnmusic opened this issue Mar 27, 2023 · 2 comments

Comments

@kennystrawnmusic
Copy link

Here's what happens when I run cargo report future-incompatibilities --id 1 while attempting to build my kernel which depends on bootloader-x86_64-uefi which depends in turn on this crate:

The following warnings were discovered during the build. These warnings are an
indication that the packages contain code that will become an error in a
future release of Rust. These warnings typically cover changes to close
soundness problems, unintended or undocumented behavior, or critical problems
that cannot be fixed in a backwards-compatible fashion, and are not expected
to be in wide use.

Each warning should contain a link for more information on what the warning
means and how to resolve it.


To solve this problem, you can try the following approaches:


- Some affected dependencies have newer versions available.
You may want to consider updating them to a newer version to see if the issue has been fixed.

uefi v0.18.0 has the following newer versions available: 0.19.0, 0.19.1, 0.20.0


- If the issue is not solved by updating the dependencies, a fix has to be
implemented by those dependencies. You can help with that by notifying the
maintainers of this problem (e.g. by creating a bug report) or by proposing a
fix to the maintainers (e.g. by creating a pull request):

  - uefi@0.18.0
  - Repository: https://github.com/rust-osdev/uefi-rs
  - Detailed warning command: `cargo report future-incompatibilities --id 1 --package uefi@0.18.0`

- If waiting for an upstream fix is not an option, you can use the `[patch]`
section in `Cargo.toml` to use your own version of the dependency. For more
information, see:
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section
        
The package `uefi v0.18.0` currently triggers the following future incompatibility lints:
> warning: byte slice in a packed struct that derives a built-in trait
>    --> /opt/rust/registry/src/index.crates.io-6f17d22bba15001f/uefi-0.18.0/src/proto/device_path/mod.rs:125:5
>     |
> 121 | #[derive(Debug, Eq, PartialEq)]
>     |          ----- in this derive macro expansion
> ...
> 125 |     data: [u8],
>     |     ^^^^^^^^^^
>     |
>     = 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 #107457 <https://github.com/rust-lang/rust/issues/107457>
>     = help: consider implementing the trait by hand, or remove the `packed` attribute
>     = note: `#[allow(byte_slice_in_packed_struct_with_derive)]` on by default
>     = note: this warning originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
> 
> warning: byte slice in a packed struct that derives a built-in trait
>    --> /opt/rust/registry/src/index.crates.io-6f17d22bba15001f/uefi-0.18.0/src/proto/device_path/mod.rs:125:5
>     |
> 121 | #[derive(Debug, Eq, PartialEq)]
>     |                     --------- in this derive macro expansion
> ...
> 125 |     data: [u8],
>     |     ^^^^^^^^^^
>     |
>     = 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 #107457 <https://github.com/rust-lang/rust/issues/107457>
>     = help: consider implementing the trait by hand, or remove the `packed` attribute
>     = note: `#[allow(byte_slice_in_packed_struct_with_derive)]` on by default
>     = note: this warning originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
> 
> warning: byte slice in a packed struct that derives a built-in trait
>    --> /opt/rust/registry/src/index.crates.io-6f17d22bba15001f/uefi-0.18.0/src/proto/device_path/mod.rs:125:5
>     |
> 121 | #[derive(Debug, Eq, PartialEq)]
>     |                     --------- in this derive macro expansion
> ...
> 125 |     data: [u8],
>     |     ^^^^^^^^^^
>     |
>     = 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 #107457 <https://github.com/rust-lang/rust/issues/107457>
>     = help: consider implementing the trait by hand, or remove the `packed` attribute
>     = note: `#[allow(byte_slice_in_packed_struct_with_derive)]` on by default
>     = note: this warning originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
> 
> warning: byte slice in a packed struct that derives a built-in trait
>    --> /opt/rust/registry/src/index.crates.io-6f17d22bba15001f/uefi-0.18.0/src/proto/device_path/mod.rs:193:5
>     |
> 191 | #[derive(Debug, Eq, PartialEq)]
>     |          ----- in this derive macro expansion
> 192 | pub struct DevicePathInstance {
> 193 |     data: [u8],
>     |     ^^^^^^^^^^
>     |
>     = 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 #107457 <https://github.com/rust-lang/rust/issues/107457>
>     = help: consider implementing the trait by hand, or remove the `packed` attribute
>     = note: `#[allow(byte_slice_in_packed_struct_with_derive)]` on by default
>     = note: this warning originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
> 
> warning: byte slice in a packed struct that derives a built-in trait
>    --> /opt/rust/registry/src/index.crates.io-6f17d22bba15001f/uefi-0.18.0/src/proto/device_path/mod.rs:193:5
>     |
> 191 | #[derive(Debug, Eq, PartialEq)]
>     |                     --------- in this derive macro expansion
> 192 | pub struct DevicePathInstance {
> 193 |     data: [u8],
>     |     ^^^^^^^^^^
>     |
>     = 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 #107457 <https://github.com/rust-lang/rust/issues/107457>
>     = help: consider implementing the trait by hand, or remove the `packed` attribute
>     = note: `#[allow(byte_slice_in_packed_struct_with_derive)]` on by default
>     = note: this warning originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
> 
> warning: byte slice in a packed struct that derives a built-in trait
>    --> /opt/rust/registry/src/index.crates.io-6f17d22bba15001f/uefi-0.18.0/src/proto/device_path/mod.rs:193:5
>     |
> 191 | #[derive(Debug, Eq, PartialEq)]
>     |                     --------- in this derive macro expansion
> 192 | pub struct DevicePathInstance {
> 193 |     data: [u8],
>     |     ^^^^^^^^^^
>     |
>     = 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 #107457 <https://github.com/rust-lang/rust/issues/107457>
>     = help: consider implementing the trait by hand, or remove the `packed` attribute
>     = note: `#[allow(byte_slice_in_packed_struct_with_derive)]` on by default
>     = note: this warning originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
> 
> warning: byte slice in a packed struct that derives a built-in trait
>    --> /opt/rust/registry/src/index.crates.io-6f17d22bba15001f/uefi-0.18.0/src/proto/device_path/mod.rs:223:5
>     |
> 221 | #[derive(Debug, Eq, PartialEq, Protocol)]
>     |          ----- in this derive macro expansion
> 222 | pub struct DevicePath {
> 223 |     data: [u8],
>     |     ^^^^^^^^^^
>     |
>     = 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 #107457 <https://github.com/rust-lang/rust/issues/107457>
>     = help: consider implementing the trait by hand, or remove the `packed` attribute
>     = note: `#[allow(byte_slice_in_packed_struct_with_derive)]` on by default
>     = note: this warning originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
> 
> warning: byte slice in a packed struct that derives a built-in trait
>    --> /opt/rust/registry/src/index.crates.io-6f17d22bba15001f/uefi-0.18.0/src/proto/device_path/mod.rs:223:5
>     |
> 221 | #[derive(Debug, Eq, PartialEq, Protocol)]
>     |                     --------- in this derive macro expansion
> 222 | pub struct DevicePath {
> 223 |     data: [u8],
>     |     ^^^^^^^^^^
>     |
>     = 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 #107457 <https://github.com/rust-lang/rust/issues/107457>
>     = help: consider implementing the trait by hand, or remove the `packed` attribute
>     = note: `#[allow(byte_slice_in_packed_struct_with_derive)]` on by default
>     = note: this warning originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
> 
> warning: byte slice in a packed struct that derives a built-in trait
>    --> /opt/rust/registry/src/index.crates.io-6f17d22bba15001f/uefi-0.18.0/src/proto/device_path/mod.rs:223:5
>     |
> 221 | #[derive(Debug, Eq, PartialEq, Protocol)]
>     |                     --------- in this derive macro expansion
> 222 | pub struct DevicePath {
> 223 |     data: [u8],
>     |     ^^^^^^^^^^
>     |
>     = 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 #107457 <https://github.com/rust-lang/rust/issues/107457>
>     = help: consider implementing the trait by hand, or remove the `packed` attribute
>     = note: `#[allow(byte_slice_in_packed_struct_with_derive)]` on by default
>     = note: this warning originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
> 

Note that all of these warnings mention rust-lang/rust#107457 which is slated to eventually outlaw the use of byte slices in packed structs that use derive macros on built-in traits. This means that, for future versions of this crate, one would need to either find a different way to store this information other than using byte slices (like using UEFI's global allocator by default to copy this data to the heap for storage as a Vec for example) or impl these built-in macros manually for these structs instead of deriving them.

@nicholasbishop
Copy link
Member

It looks like you're on an older version of the crate, uefi v0.18.0. This has been fixed already in newer releases :)

@kennystrawnmusic
Copy link
Author

It looks like you're on an older version of the crate, uefi v0.18.0. This has been fixed already in newer releases :)

This would be a bootloader bug then since that dependency of my kernel is what is in turn depending on the outdated version of uefi-rs in question. Submitted as pull request rust-osdev/bootloader#360

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

No branches or pull requests

2 participants