Skip to content

from_raw(_mut)_buf returns slices with weird lifetimes #20031

Closed
@Tobba

Description

@Tobba

These functions take a reference to the raw pointer you're trying to use and returns a slice with a lifetime based on the lifetime of your raw pointer. This behavior is not only extremely noisy, but leads to a mess of nasty transmutes or one-off variables when the raw pointer in question is calculated by i.e .offset().

A better approach might be letting the lifetime be inferred or letting the caller explicitly specify it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions