about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-03-10 17:12:27 +0100
committerRalf Jung <post@ralfj.de>2024-03-10 18:07:34 +0100
commit81ebaf27cb4301a833f5a4ba1f4a6e63cfcc32b3 (patch)
treecb5f57147734ef567f69754748a0f446634905ec
parentcdb775cab50311de54ccf3a07b331cc56b0da436 (diff)
downloadrust-81ebaf27cb4301a833f5a4ba1f4a6e63cfcc32b3.tar.gz
rust-81ebaf27cb4301a833f5a4ba1f4a6e63cfcc32b3.zip
RawVec::into_box: avoid unnecessary intermediate reference
-rw-r--r--library/alloc/src/raw_vec.rs3
-rw-r--r--tests/ui/hygiene/panic-location.rs1
-rw-r--r--tests/ui/hygiene/panic-location.run.stderr2
3 files changed, 3 insertions, 3 deletions
diff --git a/library/alloc/src/raw_vec.rs b/library/alloc/src/raw_vec.rs
index ace73c0fdaa..0ee293db73a 100644
--- a/library/alloc/src/raw_vec.rs
+++ b/library/alloc/src/raw_vec.rs
@@ -5,7 +5,6 @@ use core::cmp;
 use core::hint;
 use core::mem::{self, ManuallyDrop, MaybeUninit, SizedTypeProperties};
 use core::ptr::{self, NonNull, Unique};
-use core::slice;
 
 #[cfg(not(no_global_oom_handling))]
 use crate::alloc::handle_alloc_error;
@@ -192,7 +191,7 @@ impl<T, A: Allocator> RawVec<T, A> {
 
         let me = ManuallyDrop::new(self);
         unsafe {
-            let slice = slice::from_raw_parts_mut(me.ptr() as *mut MaybeUninit<T>, len);
+            let slice = ptr::slice_from_raw_parts_mut(me.ptr() as *mut MaybeUninit<T>, len);
             Box::from_raw_in(slice, ptr::read(&me.alloc))
         }
     }
diff --git a/tests/ui/hygiene/panic-location.rs b/tests/ui/hygiene/panic-location.rs
index a98960d74b0..b2f9bfe4f9a 100644
--- a/tests/ui/hygiene/panic-location.rs
+++ b/tests/ui/hygiene/panic-location.rs
@@ -1,6 +1,7 @@
 //@ run-fail
 //@ check-run-results
 //@ exec-env:RUST_BACKTRACE=0
+//@ normalize-stderr-test ".rs:\d+:\d+" -> ".rs:LL:CC"
 //
 // Regression test for issue #70963
 // The captured stderr from this test reports a location
diff --git a/tests/ui/hygiene/panic-location.run.stderr b/tests/ui/hygiene/panic-location.run.stderr
index ec0ce18c3df..5c1778bc485 100644
--- a/tests/ui/hygiene/panic-location.run.stderr
+++ b/tests/ui/hygiene/panic-location.run.stderr
@@ -1,3 +1,3 @@
-thread 'main' panicked at library/alloc/src/raw_vec.rs:26:5:
+thread 'main' panicked at library/alloc/src/raw_vec.rs:LL:CC:
 capacity overflow
 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace