You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code below compiles without unsafe code but accesses memory out of the allocated range.
use stabby::slice::Slice;fnmain(){let v = vec![12, 34, 56];letmut s:Slice<'_,i32> = (&v[..]).into();println!("{:?}", s);println!("{:?} {:?}", s.start, s.len);
s.start = s.start.map_addr(|a| a.checked_add(4).unwrap());println!("{:?}", s);}
I think Slices and SliceMuts cannot expose their fields directly. Instead, equivalents to core::slice::from_raw_parts* and similar functions should be considered.
The text was updated successfully, but these errors were encountered:
The code below compiles without unsafe code but accesses memory out of the allocated range.
I think
Slice
s andSliceMut
s cannot expose their fields directly. Instead, equivalents tocore::slice::from_raw_parts*
and similar functions should be considered.The text was updated successfully, but these errors were encountered: