Apply CR suggestions; add real tracking issue
This commit is contained in:
parent
4bb15b3797
commit
003b954a43
6 changed files with 14 additions and 10 deletions
|
@ -377,6 +377,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let pointee_layout = self.layout_of(substs.type_at(0))?;
|
let pointee_layout = self.layout_of(substs.type_at(0))?;
|
||||||
|
// This re-interprets an isize at ret_layout, but we already checked
|
||||||
|
// that if ret_layout is usize, then the result must be non-negative.
|
||||||
let val = ImmTy::from_scalar(val, ret_layout);
|
let val = ImmTy::from_scalar(val, ret_layout);
|
||||||
let size = ImmTy::from_int(pointee_layout.size.bytes(), ret_layout);
|
let size = ImmTy::from_int(pointee_layout.size.bytes(), ret_layout);
|
||||||
self.exact_div(&val, &size, dest)?;
|
self.exact_div(&val, &size, dest)?;
|
||||||
|
|
|
@ -127,7 +127,7 @@
|
||||||
#![feature(pattern)]
|
#![feature(pattern)]
|
||||||
#![feature(ptr_internals)]
|
#![feature(ptr_internals)]
|
||||||
#![feature(ptr_metadata)]
|
#![feature(ptr_metadata)]
|
||||||
#![feature(ptr_unsigned_offset_from)]
|
#![feature(ptr_sub_ptr)]
|
||||||
#![feature(receiver_trait)]
|
#![feature(receiver_trait)]
|
||||||
#![feature(set_ptr_value)]
|
#![feature(set_ptr_value)]
|
||||||
#![feature(slice_group_by)]
|
#![feature(slice_group_by)]
|
||||||
|
|
|
@ -126,6 +126,7 @@
|
||||||
#![feature(const_option)]
|
#![feature(const_option)]
|
||||||
#![feature(const_option_ext)]
|
#![feature(const_option_ext)]
|
||||||
#![feature(const_pin)]
|
#![feature(const_pin)]
|
||||||
|
#![feature(const_ptr_sub_ptr)]
|
||||||
#![feature(const_replace)]
|
#![feature(const_replace)]
|
||||||
#![feature(const_ptr_as_ref)]
|
#![feature(const_ptr_as_ref)]
|
||||||
#![feature(const_ptr_is_null)]
|
#![feature(const_ptr_is_null)]
|
||||||
|
|
|
@ -627,7 +627,7 @@ impl<T: ?Sized> *const T {
|
||||||
/// to [`sub`](#method.sub)). The following are all equivalent, assuming
|
/// to [`sub`](#method.sub)). The following are all equivalent, assuming
|
||||||
/// that their safety preconditions are met:
|
/// that their safety preconditions are met:
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// # #![feature(ptr_unsigned_offset_from)]
|
/// # #![feature(ptr_sub_ptr)]
|
||||||
/// # unsafe fn blah(ptr: *const i32, origin: *const i32, count: usize) -> bool {
|
/// # unsafe fn blah(ptr: *const i32, origin: *const i32, count: usize) -> bool {
|
||||||
/// ptr.sub_ptr(origin) == count
|
/// ptr.sub_ptr(origin) == count
|
||||||
/// # &&
|
/// # &&
|
||||||
|
@ -656,7 +656,7 @@ impl<T: ?Sized> *const T {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(ptr_unsigned_offset_from)]
|
/// #![feature(ptr_sub_ptr)]
|
||||||
///
|
///
|
||||||
/// let a = [0; 5];
|
/// let a = [0; 5];
|
||||||
/// let ptr1: *const i32 = &a[1];
|
/// let ptr1: *const i32 = &a[1];
|
||||||
|
@ -671,8 +671,8 @@ impl<T: ?Sized> *const T {
|
||||||
/// // This would be incorrect, as the pointers are not correctly ordered:
|
/// // This would be incorrect, as the pointers are not correctly ordered:
|
||||||
/// // ptr1.offset_from(ptr2)
|
/// // ptr1.offset_from(ptr2)
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "ptr_unsigned_offset_from", issue = "88888888")]
|
#[unstable(feature = "ptr_sub_ptr", issue = "95892")]
|
||||||
#[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "92980")]
|
#[rustc_const_unstable(feature = "const_ptr_sub_ptr", issue = "95892")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const unsafe fn sub_ptr(self, origin: *const T) -> usize
|
pub const unsafe fn sub_ptr(self, origin: *const T) -> usize
|
||||||
where
|
where
|
||||||
|
|
|
@ -803,7 +803,7 @@ impl<T: ?Sized> *mut T {
|
||||||
/// to [`sub`](#method.sub)). The following are all equivalent, assuming
|
/// to [`sub`](#method.sub)). The following are all equivalent, assuming
|
||||||
/// that their safety preconditions are met:
|
/// that their safety preconditions are met:
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// # #![feature(ptr_unsigned_offset_from)]
|
/// # #![feature(ptr_sub_ptr)]
|
||||||
/// # unsafe fn blah(ptr: *mut i32, origin: *mut i32, count: usize) -> bool {
|
/// # unsafe fn blah(ptr: *mut i32, origin: *mut i32, count: usize) -> bool {
|
||||||
/// ptr.sub_ptr(origin) == count
|
/// ptr.sub_ptr(origin) == count
|
||||||
/// # &&
|
/// # &&
|
||||||
|
@ -832,7 +832,7 @@ impl<T: ?Sized> *mut T {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(ptr_unsigned_offset_from)]
|
/// #![feature(ptr_sub_ptr)]
|
||||||
///
|
///
|
||||||
/// let mut a = [0; 5];
|
/// let mut a = [0; 5];
|
||||||
/// let p: *mut i32 = a.as_mut_ptr();
|
/// let p: *mut i32 = a.as_mut_ptr();
|
||||||
|
@ -848,8 +848,8 @@ impl<T: ?Sized> *mut T {
|
||||||
///
|
///
|
||||||
/// // This would be incorrect, as the pointers are not correctly ordered:
|
/// // This would be incorrect, as the pointers are not correctly ordered:
|
||||||
/// // ptr1.offset_from(ptr2)
|
/// // ptr1.offset_from(ptr2)
|
||||||
#[unstable(feature = "ptr_unsigned_offset_from", issue = "88888888")]
|
#[unstable(feature = "ptr_sub_ptr", issue = "95892")]
|
||||||
#[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "92980")]
|
#[rustc_const_unstable(feature = "const_ptr_sub_ptr", issue = "95892")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const unsafe fn sub_ptr(self, origin: *const T) -> usize
|
pub const unsafe fn sub_ptr(self, origin: *const T) -> usize
|
||||||
where
|
where
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
|
|
||||||
#![feature(const_ptr_offset_from)]
|
#![feature(const_ptr_offset_from)]
|
||||||
#![feature(ptr_unsigned_offset_from)]
|
#![feature(const_ptr_sub_ptr)]
|
||||||
|
#![feature(ptr_sub_ptr)]
|
||||||
|
|
||||||
struct Struct {
|
struct Struct {
|
||||||
field: (),
|
field: (),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue