Skip to content

Tracking Issue for ptr_from_ref #106116

Closed
Closed
@RalfJung

Description

@RalfJung

Feature gate: #![feature(ptr_from_ref)]

This is a tracking issue for ptr::from_{ref,mut}: methods to turn references into raw pointers without using as casts. We have methods to avoid almost all as casts around raw pointer handling, except for the initial cast from reference to raw pointer. These new methods close that gap. They also ensure that the pointee type T remains the same, without one having to repeat that type for the cast.

Public API

pub fn from_ref<T: ?Sized>(r: &T) -> *const T;
pub fn from_mut<T: ?Sized>(r: &mut T) -> *mut T;

Steps / History

Unresolved Questions

  • None yet.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API 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