Skip to content

Conversation

phip1611
Copy link
Member

@phip1611 phip1611 commented Oct 1, 2025

Follow-up for #1761

Checklist

  • Sensible git history (for example, squash "typo" or "fix" commits). See the Rewriting History guide for help.
  • Update the changelog (if necessary)

impl AtaDevice<'_> {
#[allow(clippy::needless_pass_by_ref_mut)] // cast to mutable ptr
const fn proto_mut(&mut self) -> *mut AtaPassThruProtocol {
ptr::from_ref(self.proto).cast_mut()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested this, but could we change the code to this and drop the allow?

Suggested change
ptr::from_ref(self.proto).cast_mut()
&raw mut self.proto

And same for the other functions below.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't work unfortunately

error[E0596]: cannot borrow `*self.proto` as mutable, as it is behind a `&` reference
   --> uefi/src/proto/ata/pass_thru.rs:111:9
    |
111 |         &raw mut *self.proto
    |         ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable

In general, I'm a little concerned as the proto_mut function should be unsafe, including a # Safety comment

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