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_mut_refs)]
#![feature(const_nonnull_slice_from_raw_parts)]
#![feature(const_ptr_offset)]
#![feature(const_ptr_write)]
#![feature(const_try)]
#![feature(core_intrinsics)]

View File

@ -1168,7 +1168,7 @@ extern "rust-intrinsic" {
///
/// The stabilized version of this intrinsic is [`pointer::offset`].
#[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;
/// 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`].
#[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;
/// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with

View File

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

View File

@ -285,7 +285,7 @@ impl<T: ?Sized> *const T {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[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)]
pub const unsafe fn offset(self, count: isize) -> *const T
where
@ -347,7 +347,7 @@ impl<T: ?Sized> *const T {
/// ```
#[stable(feature = "ptr_wrapping_offset", since = "1.16.0")]
#[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)]
pub const fn wrapping_offset(self, count: isize) -> *const T
where
@ -566,7 +566,7 @@ impl<T: ?Sized> *const T {
/// ```
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[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)]
pub const unsafe fn add(self, count: usize) -> Self
where
@ -630,7 +630,7 @@ impl<T: ?Sized> *const T {
/// ```
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[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]
pub const unsafe fn sub(self, count: usize) -> Self
where
@ -693,7 +693,7 @@ impl<T: ?Sized> *const T {
/// ```
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[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)]
pub const fn wrapping_add(self, count: usize) -> Self
where
@ -755,7 +755,7 @@ impl<T: ?Sized> *const T {
/// ```
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[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]
pub const fn wrapping_sub(self, count: usize) -> Self
where

View File

@ -295,7 +295,7 @@ impl<T: ?Sized> *mut T {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[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)]
pub const unsafe fn offset(self, count: isize) -> *mut T
where
@ -358,7 +358,7 @@ impl<T: ?Sized> *mut T {
/// ```
#[stable(feature = "ptr_wrapping_offset", since = "1.16.0")]
#[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)]
pub const fn wrapping_offset(self, count: isize) -> *mut T
where
@ -680,7 +680,7 @@ impl<T: ?Sized> *mut T {
/// ```
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[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)]
pub const unsafe fn add(self, count: usize) -> Self
where
@ -744,7 +744,7 @@ impl<T: ?Sized> *mut T {
/// ```
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[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]
pub const unsafe fn sub(self, count: usize) -> Self
where
@ -807,7 +807,7 @@ impl<T: ?Sized> *mut T {
/// ```
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[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)]
pub const fn wrapping_add(self, count: usize) -> Self
where
@ -869,7 +869,7 @@ impl<T: ?Sized> *mut T {
/// ```
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[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]
pub const fn wrapping_sub(self, count: usize) -> Self
where

View File

@ -499,7 +499,7 @@ impl<T> [T] {
/// assert_eq!(x, &[3, 4, 6]);
/// ```
#[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]
#[must_use]
pub const fn as_mut_ptr(&mut self) -> *mut T {
@ -535,7 +535,7 @@ impl<T> [T] {
///
/// [`as_ptr`]: slice::as_ptr
#[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]
#[must_use]
pub const fn as_ptr_range(&self) -> Range<*const T> {
@ -578,7 +578,7 @@ impl<T> [T] {
///
/// [`as_mut_ptr`]: slice::as_mut_ptr
#[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]
#[must_use]
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_read)]
#![feature(const_ptr_write)]
#![feature(const_ptr_offset)]
#![feature(const_trait_impl)]
#![feature(const_likely)]
#![feature(core_ffi_c)]

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,4 @@
// run-pass
#![feature(const_ptr_offset)]
#![feature(const_ptr_offset_from)]
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)]
use std::intrinsics::ptr_offset_from;

View File

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

View File

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