Skip to content

Commit 2b3fe45

Browse files
committed
Fix Pin example from dangerous implicit autorefs
1 parent 12f1ea5 commit 2b3fe45

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/core/src/pin.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,7 @@
651651
//! [`Unmovable`] (from the example above), we could write an assignment function like so:
652652
//!
653653
//! ```
654+
//! # #![feature(slice_ptr_len)]
654655
//! # use std::pin::Pin;
655656
//! # use std::marker::PhantomPinned;
656657
//! # use std::ptr::NonNull;
@@ -676,7 +677,7 @@
676677
//! let data_ptr = unpinned_src.data.as_ptr() as *const u8;
677678
//! let slice_ptr = unpinned_src.slice.as_ptr() as *const u8;
678679
//! let offset = slice_ptr.offset_from(data_ptr) as usize;
679-
//! let len = (*unpinned_src.slice.as_ptr()).len();
680+
//! let len = unpinned_src.slice.as_ptr().len();
680681
//!
681682
//! unpinned_self.slice = NonNull::from(&mut unpinned_self.data[offset..offset+len]);
682683
//! }

0 commit comments

Comments
 (0)