mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
stabilize const_ptr_offset
This commit is contained in:
parent
1d9c262eea
commit
3c142b0ffe
@ -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)]
|
||||
|
@ -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
|
||||
|
@ -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)]
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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> {
|
||||
|
@ -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)]
|
||||
|
@ -1,7 +1,6 @@
|
||||
// error-pattern: evaluation of constant value failed
|
||||
|
||||
#![feature(const_ptr_read)]
|
||||
#![feature(const_ptr_offset)]
|
||||
|
||||
fn main() {
|
||||
use std::ptr;
|
||||
|
@ -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" {
|
||||
|
@ -9,7 +9,6 @@
|
||||
// build-fail
|
||||
// stderr-per-bitwidth
|
||||
#![feature(const_mut_refs)]
|
||||
#![feature(const_ptr_offset)]
|
||||
#![feature(untagged_unions)]
|
||||
use std::cell::Cell;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -1,5 +1,4 @@
|
||||
// run-pass
|
||||
#![feature(const_ptr_offset)]
|
||||
#![feature(const_ptr_offset_from)]
|
||||
use std::ptr;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(const_ptr_offset)]
|
||||
use std::ptr;
|
||||
|
||||
// normalize-stderr-test "alloc\d+" -> "allocN"
|
||||
|
@ -7,7 +7,6 @@
|
||||
#![feature(
|
||||
core_intrinsics,
|
||||
const_raw_ptr_comparison,
|
||||
const_ptr_offset,
|
||||
)]
|
||||
|
||||
const FOO: &usize = &42;
|
||||
|
Loading…
Reference in New Issue
Block a user