nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 55 lines 2.7 kB view raw
1From ad649637b9a1c8ac1fdae72bdc3ccd12f04b5800 Mon Sep 17 00:00:00 2001 2From: Gert Hulselmans <gert.hulselmans@kuleuven.be> 3Date: Fri, 29 Aug 2025 23:49:53 +0200 4Subject: [PATCH] Fix some compiler warnings/errors. 5 6 - error: implicit autoref creates a reference to the dereference of a raw pointer 7 - unsafe precondition(s) violated: slice::get_unchecked_mut requires that the index is within the slice 8--- 9 src/interp.rs | 2 +- 10 src/runtime/splitter/batch.rs | 4 ++-- 11 src/runtime/str_impl.rs | 3 ++- 12 3 files changed, 5 insertions(+), 4 deletions(-) 13 14diff --git a/src/interp.rs b/src/interp.rs 15index 587afbab83c3440e0364ee33dd89afd6a1b9e1d2..7b88ce32e9eedab648cc3eae8f6f98721d2cc976 100644 16--- a/src/interp.rs 17+++ b/src/interp.rs 18@@ -653,7 +653,7 @@ impl<'a, LR: LineReader> Interp<'a, LR> { 19 cur = loop { 20 debug_assert!(cur < unsafe { (*instrs).len() }); 21 use Variable::*; 22- match unsafe { (*instrs).get_unchecked(cur) } { 23+ match unsafe { (&(*instrs)).get_unchecked(cur) } { 24 StoreConstStr(sr, s) => { 25 let sr = *sr; 26 *self.get_mut(sr) = s.clone_str() 27diff --git a/src/runtime/splitter/batch.rs b/src/runtime/splitter/batch.rs 28index cc8d05e44b49c6a0a0e930c527e35bd6773ba120..1d4c53dcb4ceca6bc6739ce5c226777b6f6a1e34 100644 29--- a/src/runtime/splitter/batch.rs 30+++ b/src/runtime/splitter/batch.rs 31@@ -1128,8 +1128,8 @@ mod generic { 32 let len = buf.len(); 33 let len_minus_64 = len.saturating_sub(V::INPUT_SIZE); 34 let mut ix = 0; 35- let field_base_ptr: *mut u64 = field_offsets.fields.get_unchecked_mut(0); 36- let newline_base_ptr: *mut u64 = newline_offsets.fields.get_unchecked_mut(0); 37+ let field_base_ptr: *mut u64 = field_offsets.fields.as_mut_ptr(); 38+ let newline_base_ptr: *mut u64 = newline_offsets.fields.as_mut_ptr(); 39 let mut field_base = 0; 40 let mut newline_base = 0; 41 42diff --git a/src/runtime/str_impl.rs b/src/runtime/str_impl.rs 43index e34176f86b7d0c4ba77f2107d3ebe571f207fbbd..4f8fbca5ac56b94765efdb3e03edfb0e82370e05 100644 44--- a/src/runtime/str_impl.rs 45+++ b/src/runtime/str_impl.rs 46@@ -727,7 +727,8 @@ impl<'a> Str<'a> { 47 ); 48 let new_len = to - from; 49 if new_len <= MAX_INLINE_SIZE { 50- return Str::from_rep(Inline::from_unchecked(&(*self.get_bytes())[from..to]).into()); 51+ let bytes: &[u8] = &*self.get_bytes(); 52+ return Str::from_rep(Inline::from_unchecked(&bytes[from..to]).into()); 53 } 54 let tag = self.rep().get_tag(); 55 let u32_max = u32::max_value() as usize;