Skip to content

Maybe unsound in new_unchecked #5

@lwz23

Description

@lwz23

Hello, thank you for your contribution in this project, I am scanning the unsoundness problem in rust project.
I notice the following code:

impl<'rt> RuntimeHandle<'rt> {
    // Creates a new RuntimeHandle; it's the caller's responsibility to make
    // sure that the runtime is not destroyed while objects under this runtime
    // are still being used
    pub fn new_unchecked(ptr: *mut sys::Runtime) -> Self {
        RuntimeHandle(ptr, PhantomData)
    }

If it is caller's responsibility to make responsibility to make are still being used, maybe this function should be marked as unsafe and doc it with ///SAFETY? This is more in line with rust's security requirements, In Rust, if only safe code is used that results in UB being considered unsound and violating Rust's security guarantees.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions