1
Fork 0

stabilize const_ptr_offset

This commit is contained in:
SaltyKitkat 2022-02-13 15:26:14 +08:00
parent 1d9c262eea
commit 3c142b0ffe
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82
15 changed files with 19 additions and 28 deletions

View file

@ -10,7 +10,6 @@
#![feature(const_intrinsic_copy)] #![feature(const_intrinsic_copy)]
#![feature(const_mut_refs)] #![feature(const_mut_refs)]
#![feature(const_nonnull_slice_from_raw_parts)] #![feature(const_nonnull_slice_from_raw_parts)]
#![feature(const_ptr_offset)]
#![feature(const_ptr_write)] #![feature(const_ptr_write)]
#![feature(const_try)] #![feature(const_try)]
#![feature(core_intrinsics)] #![feature(core_intrinsics)]

View file

@ -1168,7 +1168,7 @@ extern "rust-intrinsic" {
/// ///
/// The stabilized version of this intrinsic is [`pointer::offset`]. /// The stabilized version of this intrinsic is [`pointer::offset`].
#[must_use = "returns a new pointer rather than modifying its argument"] #[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_unstable(feature = "const_ptr_offset", issue = "71499")] #[rustc_const_stable(feature = "const_ptr_offset", since = "1.60.0")]
pub fn offset<T>(dst: *const T, offset: isize) -> *const T; pub fn offset<T>(dst: *const T, offset: isize) -> *const T;
/// Calculates the offset from a pointer, potentially wrapping. /// Calculates the offset from a pointer, potentially wrapping.
@ -1185,7 +1185,7 @@ extern "rust-intrinsic" {
/// ///
/// The stabilized version of this intrinsic is [`pointer::wrapping_offset`]. /// The stabilized version of this intrinsic is [`pointer::wrapping_offset`].
#[must_use = "returns a new pointer rather than modifying its argument"] #[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_unstable(feature = "const_ptr_offset", issue = "71499")] #[rustc_const_stable(feature = "const_ptr_offset", since = "1.60.0")]
pub fn arith_offset<T>(dst: *const T, offset: isize) -> *const T; pub fn arith_offset<T>(dst: *const T, offset: isize) -> *const T;
/// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with /// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with

View file

@ -126,7 +126,6 @@
#![feature(const_pin)] #![feature(const_pin)]
#![feature(const_replace)] #![feature(const_replace)]
#![feature(const_ptr_is_null)] #![feature(const_ptr_is_null)]
#![feature(const_ptr_offset)]
#![feature(const_ptr_offset_from)] #![feature(const_ptr_offset_from)]
#![feature(const_ptr_read)] #![feature(const_ptr_read)]
#![feature(const_ptr_write)] #![feature(const_ptr_write)]

View file

@ -285,7 +285,7 @@ impl<T: ?Sized> *const T {
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[must_use = "returns a new pointer rather than modifying its argument"] #[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_unstable(feature = "const_ptr_offset", issue = "71499")] #[rustc_const_stable(feature = "const_ptr_offset", since = "1.60.0")]
#[inline(always)] #[inline(always)]
pub const unsafe fn offset(self, count: isize) -> *const T pub const unsafe fn offset(self, count: isize) -> *const T
where where
@ -347,7 +347,7 @@ impl<T: ?Sized> *const T {
/// ``` /// ```
#[stable(feature = "ptr_wrapping_offset", since = "1.16.0")] #[stable(feature = "ptr_wrapping_offset", since = "1.16.0")]
#[must_use = "returns a new pointer rather than modifying its argument"] #[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_unstable(feature = "const_ptr_offset", issue = "71499")] #[rustc_const_stable(feature = "const_ptr_offset", since = "1.60.0")]
#[inline(always)] #[inline(always)]
pub const fn wrapping_offset(self, count: isize) -> *const T pub const fn wrapping_offset(self, count: isize) -> *const T
where where
@ -566,7 +566,7 @@ impl<T: ?Sized> *const T {
/// ``` /// ```
#[stable(feature = "pointer_methods", since = "1.26.0")] #[stable(feature = "pointer_methods", since = "1.26.0")]
#[must_use = "returns a new pointer rather than modifying its argument"] #[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_unstable(feature = "const_ptr_offset", issue = "71499")] #[rustc_const_stable(feature = "const_ptr_offset", since = "1.60.0")]
#[inline(always)] #[inline(always)]
pub const unsafe fn add(self, count: usize) -> Self pub const unsafe fn add(self, count: usize) -> Self
where where
@ -630,7 +630,7 @@ impl<T: ?Sized> *const T {
/// ``` /// ```
#[stable(feature = "pointer_methods", since = "1.26.0")] #[stable(feature = "pointer_methods", since = "1.26.0")]
#[must_use = "returns a new pointer rather than modifying its argument"] #[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_unstable(feature = "const_ptr_offset", issue = "71499")] #[rustc_const_stable(feature = "const_ptr_offset", since = "1.60.0")]
#[inline] #[inline]
pub const unsafe fn sub(self, count: usize) -> Self pub const unsafe fn sub(self, count: usize) -> Self
where where
@ -693,7 +693,7 @@ impl<T: ?Sized> *const T {
/// ``` /// ```
#[stable(feature = "pointer_methods", since = "1.26.0")] #[stable(feature = "pointer_methods", since = "1.26.0")]
#[must_use = "returns a new pointer rather than modifying its argument"] #[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_unstable(feature = "const_ptr_offset", issue = "71499")] #[rustc_const_stable(feature = "const_ptr_offset", since = "1.60.0")]
#[inline(always)] #[inline(always)]
pub const fn wrapping_add(self, count: usize) -> Self pub const fn wrapping_add(self, count: usize) -> Self
where where
@ -755,7 +755,7 @@ impl<T: ?Sized> *const T {
/// ``` /// ```
#[stable(feature = "pointer_methods", since = "1.26.0")] #[stable(feature = "pointer_methods", since = "1.26.0")]
#[must_use = "returns a new pointer rather than modifying its argument"] #[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_unstable(feature = "const_ptr_offset", issue = "71499")] #[rustc_const_stable(feature = "const_ptr_offset", since = "1.60.0")]
#[inline] #[inline]
pub const fn wrapping_sub(self, count: usize) -> Self pub const fn wrapping_sub(self, count: usize) -> Self
where where

View file

@ -295,7 +295,7 @@ impl<T: ?Sized> *mut T {
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[must_use = "returns a new pointer rather than modifying its argument"] #[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_unstable(feature = "const_ptr_offset", issue = "71499")] #[rustc_const_stable(feature = "const_ptr_offset", since = "1.60.0")]
#[inline(always)] #[inline(always)]
pub const unsafe fn offset(self, count: isize) -> *mut T pub const unsafe fn offset(self, count: isize) -> *mut T
where where
@ -358,7 +358,7 @@ impl<T: ?Sized> *mut T {
/// ``` /// ```
#[stable(feature = "ptr_wrapping_offset", since = "1.16.0")] #[stable(feature = "ptr_wrapping_offset", since = "1.16.0")]
#[must_use = "returns a new pointer rather than modifying its argument"] #[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_unstable(feature = "const_ptr_offset", issue = "71499")] #[rustc_const_stable(feature = "const_ptr_offset", since = "1.60.0")]
#[inline(always)] #[inline(always)]
pub const fn wrapping_offset(self, count: isize) -> *mut T pub const fn wrapping_offset(self, count: isize) -> *mut T
where where
@ -680,7 +680,7 @@ impl<T: ?Sized> *mut T {
/// ``` /// ```
#[stable(feature = "pointer_methods", since = "1.26.0")] #[stable(feature = "pointer_methods", since = "1.26.0")]
#[must_use = "returns a new pointer rather than modifying its argument"] #[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_unstable(feature = "const_ptr_offset", issue = "71499")] #[rustc_const_stable(feature = "const_ptr_offset", since = "1.60.0")]
#[inline(always)] #[inline(always)]
pub const unsafe fn add(self, count: usize) -> Self pub const unsafe fn add(self, count: usize) -> Self
where where
@ -744,7 +744,7 @@ impl<T: ?Sized> *mut T {
/// ``` /// ```
#[stable(feature = "pointer_methods", since = "1.26.0")] #[stable(feature = "pointer_methods", since = "1.26.0")]
#[must_use = "returns a new pointer rather than modifying its argument"] #[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_unstable(feature = "const_ptr_offset", issue = "71499")] #[rustc_const_stable(feature = "const_ptr_offset", since = "1.60.0")]
#[inline] #[inline]
pub const unsafe fn sub(self, count: usize) -> Self pub const unsafe fn sub(self, count: usize) -> Self
where where
@ -807,7 +807,7 @@ impl<T: ?Sized> *mut T {
/// ``` /// ```
#[stable(feature = "pointer_methods", since = "1.26.0")] #[stable(feature = "pointer_methods", since = "1.26.0")]
#[must_use = "returns a new pointer rather than modifying its argument"] #[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_unstable(feature = "const_ptr_offset", issue = "71499")] #[rustc_const_stable(feature = "const_ptr_offset", since = "1.60.0")]
#[inline(always)] #[inline(always)]
pub const fn wrapping_add(self, count: usize) -> Self pub const fn wrapping_add(self, count: usize) -> Self
where where
@ -869,7 +869,7 @@ impl<T: ?Sized> *mut T {
/// ``` /// ```
#[stable(feature = "pointer_methods", since = "1.26.0")] #[stable(feature = "pointer_methods", since = "1.26.0")]
#[must_use = "returns a new pointer rather than modifying its argument"] #[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_unstable(feature = "const_ptr_offset", issue = "71499")] #[rustc_const_stable(feature = "const_ptr_offset", since = "1.60.0")]
#[inline] #[inline]
pub const fn wrapping_sub(self, count: usize) -> Self pub const fn wrapping_sub(self, count: usize) -> Self
where where

View file

@ -499,7 +499,7 @@ impl<T> [T] {
/// assert_eq!(x, &[3, 4, 6]); /// assert_eq!(x, &[3, 4, 6]);
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_ptr_offset", issue = "71499")] #[rustc_const_stable(feature = "const_ptr_offset", since = "1.60.0")]
#[inline] #[inline]
#[must_use] #[must_use]
pub const fn as_mut_ptr(&mut self) -> *mut T { pub const fn as_mut_ptr(&mut self) -> *mut T {
@ -535,7 +535,7 @@ impl<T> [T] {
/// ///
/// [`as_ptr`]: slice::as_ptr /// [`as_ptr`]: slice::as_ptr
#[stable(feature = "slice_ptr_range", since = "1.48.0")] #[stable(feature = "slice_ptr_range", since = "1.48.0")]
#[rustc_const_unstable(feature = "const_ptr_offset", issue = "71499")] #[rustc_const_stable(feature = "const_ptr_offset", since = "1.60.0")]
#[inline] #[inline]
#[must_use] #[must_use]
pub const fn as_ptr_range(&self) -> Range<*const T> { pub const fn as_ptr_range(&self) -> Range<*const T> {
@ -578,7 +578,7 @@ impl<T> [T] {
/// ///
/// [`as_mut_ptr`]: slice::as_mut_ptr /// [`as_mut_ptr`]: slice::as_mut_ptr
#[stable(feature = "slice_ptr_range", since = "1.48.0")] #[stable(feature = "slice_ptr_range", since = "1.48.0")]
#[rustc_const_unstable(feature = "const_ptr_offset", issue = "71499")] #[rustc_const_stable(feature = "const_ptr_offset", since = "1.60.0")]
#[inline] #[inline]
#[must_use] #[must_use]
pub const fn as_mut_ptr_range(&mut self) -> Range<*mut T> { pub const fn as_mut_ptr_range(&mut self) -> Range<*mut T> {

View file

@ -20,7 +20,6 @@
#![feature(const_ptr_as_ref)] #![feature(const_ptr_as_ref)]
#![feature(const_ptr_read)] #![feature(const_ptr_read)]
#![feature(const_ptr_write)] #![feature(const_ptr_write)]
#![feature(const_ptr_offset)]
#![feature(const_trait_impl)] #![feature(const_trait_impl)]
#![feature(const_likely)] #![feature(const_likely)]
#![feature(core_ffi_c)] #![feature(core_ffi_c)]

View file

@ -1,7 +1,6 @@
// error-pattern: evaluation of constant value failed // error-pattern: evaluation of constant value failed
#![feature(const_ptr_read)] #![feature(const_ptr_read)]
#![feature(const_ptr_offset)]
fn main() { fn main() {
use std::ptr; use std::ptr;

View file

@ -2,7 +2,7 @@
// ignore-tidy-linelength // ignore-tidy-linelength
#![feature(intrinsics, staged_api)] #![feature(intrinsics, staged_api)]
#![feature(const_mut_refs, const_intrinsic_copy, const_ptr_offset)] #![feature(const_mut_refs, const_intrinsic_copy)]
use std::mem; use std::mem;
extern "rust-intrinsic" { extern "rust-intrinsic" {

View file

@ -9,7 +9,6 @@
// build-fail // build-fail
// stderr-per-bitwidth // stderr-per-bitwidth
#![feature(const_mut_refs)] #![feature(const_mut_refs)]
#![feature(const_ptr_offset)]
#![feature(untagged_unions)] #![feature(untagged_unions)]
use std::cell::Cell; use std::cell::Cell;

View file

@ -1,6 +1,5 @@
// error-pattern unable to turn pointer into raw bytes // error-pattern unable to turn pointer into raw bytes
#![feature(const_ptr_read)] #![feature(const_ptr_read)]
#![feature(const_ptr_offset)]
const C: () = unsafe { const C: () = unsafe {
let foo = Some(&42 as *const i32); let foo = Some(&42 as *const i32);

View file

@ -1,5 +1,4 @@
// run-pass // run-pass
#![feature(const_ptr_offset)]
#![feature(const_ptr_offset_from)] #![feature(const_ptr_offset_from)]
use std::ptr; use std::ptr;

View file

@ -1,4 +1,4 @@
#![feature(const_ptr_offset_from, const_ptr_offset)] #![feature(const_ptr_offset_from)]
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
use std::intrinsics::ptr_offset_from; use std::intrinsics::ptr_offset_from;

View file

@ -1,4 +1,3 @@
#![feature(const_ptr_offset)]
use std::ptr; use std::ptr;
// normalize-stderr-test "alloc\d+" -> "allocN" // normalize-stderr-test "alloc\d+" -> "allocN"

View file

@ -7,7 +7,6 @@
#![feature( #![feature(
core_intrinsics, core_intrinsics,
const_raw_ptr_comparison, const_raw_ptr_comparison,
const_ptr_offset,
)] )]
const FOO: &usize = &42; const FOO: &usize = &42;