Tracking Issue for const_swap · Issue #83163 · rust-lang/rust (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@usbalbin

Description

@usbalbin

Feature gate: #![feature(const_swap)]

This is a tracking issue for making the functions mem::swap and ptr::swap[_nonoverlapping] and some other swap related functions const fn.

Public API

mod ptr { pub const unsafe fn swap(x: *mut T, y: *mut T); }

mod mem { pub const fn swap(x: &mut T, y: &mut T); }

impl [T] { pub const fn swap(&mut self, a: usize, b: usize); }

impl<T: ?Sized> *mut T { pub const unsafe fn swap(self, with: *mut T); }

impl NonNull { pub const unsafe fn swap(self, with: NonNull); }

Steps / History

Unresolved Questions