Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #130767

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d05323c
rustdoc: redesign toolbar and disclosure widgets
notriddle Aug 25, 2024
5b1b2e9
rustdoc: make the header show all three buttons
notriddle Sep 3, 2024
df307d0
rustdoc: tweak spacing in toolbar
notriddle Sep 3, 2024
7a19b17
Skip query in get_parent_item when possible.
m-ou-se Sep 20, 2024
c0c569f
Update compiler/rustc_middle/src/hir/map/mod.rs
m-ou-se Sep 23, 2024
fbafb6c
Pass bootstrap cargo when `--stage 0` and `COMPILETST_FORCE_STAGE0`
jieyouxu Sep 23, 2024
f870a35
Fix `run-make-support` to respect per-stage cargo
jieyouxu Sep 23, 2024
6d8150f
Update `run-make` tests to use `cargo` wrapper cmd
jieyouxu Sep 23, 2024
9ab7046
Add new Tier-3 target: `loongarch64-unknown-linux-ohos`
yetist Sep 13, 2024
e31a719
Fix up standard library intro
notriddle Sep 11, 2024
cc3ffe4
Tweak breadcrumbs list
notriddle Sep 11, 2024
de66639
Revert "Add recursion limit to FFI safety lint"
compiler-errors Sep 23, 2024
9050b33
Add a test
compiler-errors Sep 23, 2024
c3f57f3
Update books
rustbot Sep 23, 2024
2787179
stabilize const_intrinsic_copy
RalfJung Sep 23, 2024
702a644
Check vtable projections for validity in miri
compiler-errors Sep 23, 2024
c435538
Rollup merge of #129545 - notriddle:notriddle/toolbar-v2, r=Guillaume…
compiler-errors Sep 24, 2024
342250b
Rollup merge of #130618 - m-ou-se:skip-query, r=compiler-errors
compiler-errors Sep 24, 2024
3975a95
Rollup merge of #130727 - compiler-errors:objects, r=RalfJung
compiler-errors Sep 24, 2024
dcd099e
Rollup merge of #130739 - jieyouxu:stage0_run_make, r=Kobzol
compiler-errors Sep 24, 2024
54fd38b
Rollup merge of #130750 - heiher:loong-linux-ohos-tier3, r=jieyouxu
compiler-errors Sep 24, 2024
d7517ec
Rollup merge of #130758 - compiler-errors:ctype-recursion-limit, r=ji…
compiler-errors Sep 24, 2024
407d959
Rollup merge of #130759 - rustbot:docs-update, r=ehuss
compiler-errors Sep 24, 2024
548f11a
Rollup merge of #130762 - RalfJung:const_intrinsic_copy, r=dtolnay
compiler-errors Sep 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
stabilize const_intrinsic_copy
  • Loading branch information
RalfJung committed Sep 23, 2024
commit 2787179f53d2b7904a413fc51bfe0e41f539b9b5
8 changes: 4 additions & 4 deletions library/core/src/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3286,13 +3286,13 @@ pub const fn ptr_metadata<P: ptr::Pointee<Metadata = M> + ?Sized, M>(_ptr: *cons
#[doc(alias = "memcpy")]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_allowed_through_unstable_modules]
#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")]
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "CURRENT_RUSTC_VERSION")]
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
#[rustc_diagnostic_item = "ptr_copy_nonoverlapping"]
pub const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize) {
extern "rust-intrinsic" {
#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")]
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "CURRENT_RUSTC_VERSION")]
#[rustc_nounwind]
pub fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
}
Expand Down Expand Up @@ -3388,13 +3388,13 @@ pub const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: us
#[doc(alias = "memmove")]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_allowed_through_unstable_modules]
#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")]
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "CURRENT_RUSTC_VERSION")]
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
#[rustc_diagnostic_item = "ptr_copy"]
pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
extern "rust-intrinsic" {
#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")]
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "CURRENT_RUSTC_VERSION")]
#[rustc_nounwind]
fn copy<T>(src: *const T, dst: *mut T, count: usize);
}
Expand Down
1 change: 0 additions & 1 deletion library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@
#![feature(const_hash)]
#![feature(const_heap)]
#![feature(const_index_range_slice_index)]
#![feature(const_intrinsic_copy)]
#![feature(const_intrinsic_forget)]
#![feature(const_ipv4)]
#![feature(const_ipv6)]
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/ptr/const_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ impl<T: ?Sized> *const T {
/// See [`ptr::copy`] for safety concerns and examples.
///
/// [`ptr::copy`]: crate::ptr::copy()
#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")]
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[inline]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
Expand All @@ -1212,7 +1212,7 @@ impl<T: ?Sized> *const T {
/// See [`ptr::copy_nonoverlapping`] for safety concerns and examples.
///
/// [`ptr::copy_nonoverlapping`]: crate::ptr::copy_nonoverlapping()
#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")]
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[inline]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
Expand Down
6 changes: 1 addition & 5 deletions library/core/src/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1516,11 +1516,7 @@ pub const unsafe fn read<T>(src: *const T) -> T {
#[inline]
#[stable(feature = "ptr_unaligned", since = "1.17.0")]
#[rustc_const_stable(feature = "const_ptr_read", since = "1.71.0")]
#[rustc_allow_const_fn_unstable(
const_mut_refs,
const_maybe_uninit_as_mut_ptr,
const_intrinsic_copy
)]
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
#[rustc_diagnostic_item = "ptr_read_unaligned"]
pub const unsafe fn read_unaligned<T>(src: *const T) -> T {
Expand Down
8 changes: 4 additions & 4 deletions library/core/src/ptr/mut_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ impl<T: ?Sized> *mut T {
/// See [`ptr::copy`] for safety concerns and examples.
///
/// [`ptr::copy`]: crate::ptr::copy()
#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")]
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
Expand All @@ -1289,7 +1289,7 @@ impl<T: ?Sized> *mut T {
/// See [`ptr::copy_nonoverlapping`] for safety concerns and examples.
///
/// [`ptr::copy_nonoverlapping`]: crate::ptr::copy_nonoverlapping()
#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")]
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
Expand All @@ -1309,7 +1309,7 @@ impl<T: ?Sized> *mut T {
/// See [`ptr::copy`] for safety concerns and examples.
///
/// [`ptr::copy`]: crate::ptr::copy()
#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")]
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
Expand All @@ -1329,7 +1329,7 @@ impl<T: ?Sized> *mut T {
/// See [`ptr::copy_nonoverlapping`] for safety concerns and examples.
///
/// [`ptr::copy_nonoverlapping`]: crate::ptr::copy_nonoverlapping()
#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")]
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
Expand Down
8 changes: 4 additions & 4 deletions library/core/src/ptr/non_null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ impl<T: ?Sized> NonNull<T> {
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
#[stable(feature = "non_null_convenience", since = "1.80.0")]
#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")]
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "CURRENT_RUSTC_VERSION")]
pub const unsafe fn copy_to(self, dest: NonNull<T>, count: usize)
where
T: Sized,
Expand All @@ -944,7 +944,7 @@ impl<T: ?Sized> NonNull<T> {
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
#[stable(feature = "non_null_convenience", since = "1.80.0")]
#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")]
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "CURRENT_RUSTC_VERSION")]
pub const unsafe fn copy_to_nonoverlapping(self, dest: NonNull<T>, count: usize)
where
T: Sized,
Expand All @@ -964,7 +964,7 @@ impl<T: ?Sized> NonNull<T> {
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
#[stable(feature = "non_null_convenience", since = "1.80.0")]
#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")]
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "CURRENT_RUSTC_VERSION")]
pub const unsafe fn copy_from(self, src: NonNull<T>, count: usize)
where
T: Sized,
Expand All @@ -984,7 +984,7 @@ impl<T: ?Sized> NonNull<T> {
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
#[stable(feature = "non_null_convenience", since = "1.80.0")]
#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")]
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "CURRENT_RUSTC_VERSION")]
pub const unsafe fn copy_from_nonoverlapping(self, src: NonNull<T>, count: usize)
where
T: Sized,
Expand Down
1 change: 0 additions & 1 deletion library/core/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#![feature(const_cell_into_inner)]
#![feature(const_hash)]
#![feature(const_heap)]
#![feature(const_intrinsic_copy)]
#![feature(const_ip)]
#![feature(const_ipv4)]
#![feature(const_ipv6)]
Expand Down
2 changes: 0 additions & 2 deletions library/portable-simd/crates/core_simd/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#![no_std]
#![feature(
const_intrinsic_copy,
const_refs_to_cell,
const_maybe_uninit_as_mut_ptr,
const_mut_refs,
convert_float_to_int,
core_intrinsics,
Expand Down
3 changes: 0 additions & 3 deletions tests/ui/consts/const-eval/raw-pointer-ub.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#![feature(const_intrinsic_copy)]


const MISALIGNED_LOAD: () = unsafe {
let mem = [0u32; 8];
let ptr = mem.as_ptr().byte_add(1);
Expand Down
10 changes: 5 additions & 5 deletions tests/ui/consts/const-eval/raw-pointer-ub.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error[E0080]: evaluation of constant value failed
--> $DIR/raw-pointer-ub.rs:7:16
--> $DIR/raw-pointer-ub.rs:4:16
|
LL | let _val = *ptr;
| ^^^^ accessing memory based on pointer with alignment 1, but alignment 4 is required

error[E0080]: evaluation of constant value failed
--> $DIR/raw-pointer-ub.rs:14:5
--> $DIR/raw-pointer-ub.rs:11:5
|
LL | *ptr = 0;
| ^^^^^^^^ accessing memory based on pointer with alignment 1, but alignment 4 is required
Expand All @@ -20,19 +20,19 @@ note: inside `copy_nonoverlapping::<u32>`
note: inside `std::ptr::const_ptr::<impl *const u32>::copy_to_nonoverlapping`
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `MISALIGNED_COPY`
--> $DIR/raw-pointer-ub.rs:22:5
--> $DIR/raw-pointer-ub.rs:19:5
|
LL | y.copy_to_nonoverlapping(&mut z, 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0080]: evaluation of constant value failed
--> $DIR/raw-pointer-ub.rs:34:16
--> $DIR/raw-pointer-ub.rs:31:16
|
LL | let _val = (*ptr).0;
| ^^^^^^^^ accessing memory based on pointer with alignment 4, but alignment 16 is required

error[E0080]: evaluation of constant value failed
--> $DIR/raw-pointer-ub.rs:41:16
--> $DIR/raw-pointer-ub.rs:38:16
|
LL | let _val = *ptr;
| ^^^^ memory access failed: expected a pointer to 8 bytes of memory, but got ALLOC0 which is only 4 bytes from the end of the allocation
Expand Down
Loading