Skip to content

Missing safety blocks in solid/io.rs #135904

Open
@JorgeCepeda

Description

@JorgeCepeda

Location

  • Second impl block for BorrowedFd<'_>, safety is in the first one:
    let fd = sys::net::cvt(unsafe { sys::net::netc::dup(self.as_raw_fd()) })?;
    Ok(unsafe { OwnedFd::from_raw_fd(fd) })
  • Near impl safety block of OwnedFd:
    fn drop(&mut self) {
    unsafe { sys::net::netc::close(self.fd.as_inner()) };

Summary

This is my first issue so maybe there is no issue.
I'm checking some unsafe blocks just in case something is missing and there are those without safety blocks.

Since I saw a different file with a safety block in the drop function (see:

fn drop(&mut self) {
// SAFETY: Invariant states it is valid, and we don't drop the old value.
unsafe {
) I thought it may be missing here.

What guide could I check to make sure?
Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-cleanupCategory: PRs that clean code up or issues documenting cleanup.T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions