about summary refs log tree commit diff
path: root/library/std
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-03-27 10:44:27 +0000
committerbors <bors@rust-lang.org>2023-03-27 10:44:27 +0000
commit553ecbe8bae12bc43a34ac0b8a63e17026ce1e8a (patch)
treea6f0f5595f20fea86645f5d4cb75a91722ff5578 /library/std
parent7a0600714ab1a4cb2d1a88cd0660b9f9a2c07309 (diff)
parent6535e66fa545acaa3c0fe015b83a2e502c10119a (diff)
downloadrust-553ecbe8bae12bc43a34ac0b8a63e17026ce1e8a.tar.gz
rust-553ecbe8bae12bc43a34ac0b8a63e17026ce1e8a.zip
Auto merge of #109652 - matthiaskrgr:rollup-pbw3hi3, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #97506 (Stabilize `nonnull_slice_from_raw_parts`)
 - #98651 (Follow C-RW-VALUE in std::io::Cursor example)
 - #102742 (Remove unnecessary raw pointer in __rust_start_panic arg)
 - #109587 (Use an IndexVec to debug fingerprints.)
 - #109613 (fix type suggestions in match arms)
 - #109633 (Fix "Directly go to item in search if there is only one result" setting)
 - #109635 (debuginfo: Get pointer size/align from tcx.data_layout instead of layout_of)
 - #109641 (Don't elaborate non-obligations into obligations)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/std')
-rw-r--r--library/std/src/io/cursor.rs2
-rw-r--r--library/std/src/lib.rs1
-rw-r--r--library/std/src/panicking.rs15
3 files changed, 6 insertions, 12 deletions
diff --git a/library/std/src/io/cursor.rs b/library/std/src/io/cursor.rs
index d98ab021cad..25c64240e74 100644
--- a/library/std/src/io/cursor.rs
+++ b/library/std/src/io/cursor.rs
@@ -34,7 +34,7 @@ use crate::io::{self, BorrowedCursor, ErrorKind, IoSlice, IoSliceMut, SeekFrom};
 /// use std::fs::File;
 ///
 /// // a library function we've written
-/// fn write_ten_bytes_at_end<W: Write + Seek>(writer: &mut W) -> io::Result<()> {
+/// fn write_ten_bytes_at_end<W: Write + Seek>(mut writer: W) -> io::Result<()> {
 ///     writer.seek(SeekFrom::End(-10))?;
 ///
 ///     for i in 0..10 {
diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs
index 4e7b6080835..baad6de707b 100644
--- a/library/std/src/lib.rs
+++ b/library/std/src/lib.rs
@@ -292,7 +292,6 @@
 #![feature(is_some_and)]
 #![feature(maybe_uninit_slice)]
 #![feature(maybe_uninit_write_slice)]
-#![feature(nonnull_slice_from_raw_parts)]
 #![feature(panic_can_unwind)]
 #![feature(panic_info_message)]
 #![feature(panic_internals)]
diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs
index e59f32af77d..e505466e535 100644
--- a/library/std/src/panicking.rs
+++ b/library/std/src/panicking.rs
@@ -46,12 +46,10 @@ extern "C" {
     fn __rust_panic_cleanup(payload: *mut u8) -> *mut (dyn Any + Send + 'static);
 }
 
-#[allow(improper_ctypes)]
 extern "Rust" {
-    /// `payload` is passed through another layer of raw pointers as `&mut dyn Trait` is not
-    /// FFI-safe. `BoxMeUp` lazily performs allocation only when needed (this avoids allocations
-    /// when using the "abort" panic runtime).
-    fn __rust_start_panic(payload: *mut &mut dyn BoxMeUp) -> u32;
+    /// `BoxMeUp` lazily performs allocation only when needed (this avoids
+    /// allocations when using the "abort" panic runtime).
+    fn __rust_start_panic(payload: &mut dyn BoxMeUp) -> u32;
 }
 
 /// This function is called by the panic runtime if FFI code catches a Rust
@@ -738,10 +736,7 @@ pub fn rust_panic_without_hook(payload: Box<dyn Any + Send>) -> ! {
 /// yer breakpoints.
 #[inline(never)]
 #[cfg_attr(not(test), rustc_std_internal_symbol)]
-fn rust_panic(mut msg: &mut dyn BoxMeUp) -> ! {
-    let code = unsafe {
-        let obj = &mut msg as *mut &mut dyn BoxMeUp;
-        __rust_start_panic(obj)
-    };
+fn rust_panic(msg: &mut dyn BoxMeUp) -> ! {
+    let code = unsafe { __rust_start_panic(msg) };
     rtabort!("failed to initiate panic, error {code}")
 }