mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Apply CR suggestions; add real tracking issue
This commit is contained in:
parent
4bb15b3797
commit
003b954a43
@ -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))?;
|
||||
// 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 size = ImmTy::from_int(pointee_layout.size.bytes(), ret_layout);
|
||||
self.exact_div(&val, &size, dest)?;
|
||||
|
@ -127,7 +127,7 @@
|
||||
#![feature(pattern)]
|
||||
#![feature(ptr_internals)]
|
||||
#![feature(ptr_metadata)]
|
||||
#![feature(ptr_unsigned_offset_from)]
|
||||
#![feature(ptr_sub_ptr)]
|
||||
#![feature(receiver_trait)]
|
||||
#![feature(set_ptr_value)]
|
||||
#![feature(slice_group_by)]
|
||||
|
@ -126,6 +126,7 @@
|
||||
#![feature(const_option)]
|
||||
#![feature(const_option_ext)]
|
||||
#![feature(const_pin)]
|
||||
#![feature(const_ptr_sub_ptr)]
|
||||
#![feature(const_replace)]
|
||||
#![feature(const_ptr_as_ref)]
|
||||
#![feature(const_ptr_is_null)]
|
||||
|
@ -627,7 +627,7 @@ impl<T: ?Sized> *const T {
|
||||
/// to [`sub`](#method.sub)). The following are all equivalent, assuming
|
||||
/// that their safety preconditions are met:
|
||||
/// ```rust
|
||||
/// # #![feature(ptr_unsigned_offset_from)]
|
||||
/// # #![feature(ptr_sub_ptr)]
|
||||
/// # unsafe fn blah(ptr: *const i32, origin: *const i32, count: usize) -> bool {
|
||||
/// ptr.sub_ptr(origin) == count
|
||||
/// # &&
|
||||
@ -656,7 +656,7 @@ impl<T: ?Sized> *const T {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(ptr_unsigned_offset_from)]
|
||||
/// #![feature(ptr_sub_ptr)]
|
||||
///
|
||||
/// let a = [0; 5];
|
||||
/// 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:
|
||||
/// // ptr1.offset_from(ptr2)
|
||||
/// ```
|
||||
#[unstable(feature = "ptr_unsigned_offset_from", issue = "88888888")]
|
||||
#[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "92980")]
|
||||
#[unstable(feature = "ptr_sub_ptr", issue = "95892")]
|
||||
#[rustc_const_unstable(feature = "const_ptr_sub_ptr", issue = "95892")]
|
||||
#[inline]
|
||||
pub const unsafe fn sub_ptr(self, origin: *const T) -> usize
|
||||
where
|
||||
|
@ -803,7 +803,7 @@ impl<T: ?Sized> *mut T {
|
||||
/// to [`sub`](#method.sub)). The following are all equivalent, assuming
|
||||
/// that their safety preconditions are met:
|
||||
/// ```rust
|
||||
/// # #![feature(ptr_unsigned_offset_from)]
|
||||
/// # #![feature(ptr_sub_ptr)]
|
||||
/// # unsafe fn blah(ptr: *mut i32, origin: *mut i32, count: usize) -> bool {
|
||||
/// ptr.sub_ptr(origin) == count
|
||||
/// # &&
|
||||
@ -832,7 +832,7 @@ impl<T: ?Sized> *mut T {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(ptr_unsigned_offset_from)]
|
||||
/// #![feature(ptr_sub_ptr)]
|
||||
///
|
||||
/// let mut a = [0; 5];
|
||||
/// 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:
|
||||
/// // ptr1.offset_from(ptr2)
|
||||
#[unstable(feature = "ptr_unsigned_offset_from", issue = "88888888")]
|
||||
#[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "92980")]
|
||||
#[unstable(feature = "ptr_sub_ptr", issue = "95892")]
|
||||
#[rustc_const_unstable(feature = "const_ptr_sub_ptr", issue = "95892")]
|
||||
#[inline]
|
||||
pub const unsafe fn sub_ptr(self, origin: *const T) -> usize
|
||||
where
|
||||
|
@ -1,7 +1,8 @@
|
||||
// run-pass
|
||||
|
||||
#![feature(const_ptr_offset_from)]
|
||||
#![feature(ptr_unsigned_offset_from)]
|
||||
#![feature(const_ptr_sub_ptr)]
|
||||
#![feature(ptr_sub_ptr)]
|
||||
|
||||
struct Struct {
|
||||
field: (),
|
||||
|
Loading…
Reference in New Issue
Block a user