Auto merge of #84053 - RalfJung:liballoc-miri, r=Manishearth
fix incorrect Box::from_raw_in doctest Now that Miri can run doctests, I ran it on liballoc, and found exactly one problem: this test creates a `Box<u8>` to deallocate a 4-byte allocation! Introduced by https://github.com/rust-lang/rust/pull/80310 so r? `@Manishearth` `@kennytm`
This commit is contained in:
commit
ef38b45e8b
1 changed files with 1 additions and 1 deletions
|
@ -793,7 +793,7 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
|
|||
/// use std::alloc::{Allocator, Layout, System};
|
||||
///
|
||||
/// unsafe {
|
||||
/// let ptr = System.allocate(Layout::new::<i32>())?.as_mut_ptr();
|
||||
/// let ptr = System.allocate(Layout::new::<i32>())?.as_mut_ptr() as *mut i32;
|
||||
/// // In general .write is required to avoid attempting to destruct
|
||||
/// // the (uninitialized) previous contents of `ptr`, though for this
|
||||
/// // simple example `*ptr = 5` would have worked as well.
|
||||
|
|
Loading…
Add table
Reference in a new issue