-
Couldn't load subscription status.
- Fork 230
Make ZeroVec miri-clean with stacked borrows #6728
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,7 @@ | |
| ) | ||
| )] | ||
| #![warn(missing_docs)] | ||
| #![feature(ptr_metadata)] | ||
|
|
||
| #[cfg(feature = "alloc")] | ||
| extern crate alloc; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,6 +73,7 @@ | |
| ) | ||
| )] | ||
| #![warn(missing_docs)] | ||
| #![feature(ptr_metadata)] | ||
|
|
||
| extern crate alloc; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -185,8 +185,14 @@ impl<'a, V: VarULE + ?Sized> VarZeroCow<'a, V> { | |||||||||||||
| /// Construct a new borrowed version of this | ||||||||||||||
| #[cfg(feature = "alloc")] | ||||||||||||||
| pub fn new_owned(val: Box<V>) -> Self { | ||||||||||||||
| let val = ManuallyDrop::new(val); | ||||||||||||||
| let buf: NonNull<[u8]> = val.as_bytes().into(); | ||||||||||||||
| let len = val.as_bytes().len(); | ||||||||||||||
| let raw_v = Box::into_raw(val) as *mut V; | ||||||||||||||
| // disallowed? | ||||||||||||||
| // let raw_u8: *mut u8 = raw_v as *mut [u8] as *mut u8; | ||||||||||||||
| let raw_u8: *mut u8 = raw_v as *mut () as *mut u8; | ||||||||||||||
|
Comment on lines
+190
to
+192
|
||||||||||||||
| // disallowed? | |
| // let raw_u8: *mut u8 = raw_v as *mut [u8] as *mut u8; | |
| let raw_u8: *mut u8 = raw_v as *mut () as *mut u8; | |
| // SAFETY: `V: VarULE` guarantees that the memory layout of `V` is a valid byte slice, | |
| // and `Box<V>` is heap-allocated, so it is safe to treat its pointer as a pointer to bytes. | |
| let raw_u8: *mut u8 = raw_v as *mut u8; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be
#![feature(ptr_metadata)]to enable the feature, not#![cfg(ptr_metadata)]which is a conditional compilation attribute.