diff --git a/library/core/src/pin.rs b/library/core/src/pin.rs
index 74ecb5ee4946f..e49faf9eddbdc 100644
--- a/library/core/src/pin.rs
+++ b/library/core/src/pin.rs
@@ -831,15 +831,13 @@
//! fn get_pin_mut(self: [Pin]<[`&mut Self`]>) -> [Pin]<[`&mut T`]>.
//! Then we could do the following:
//! ```compile_fail
-//! # use std::cell::RefCell;
-//! # use std::pin::Pin;
-//! fn exploit_ref_cell(rc: Pin<&mut RefCell>) {
+//! fn exploit_ref_cell(mut rc: Pin<&mut RefCell>) {
//! // Here we get pinned access to the `T`.
//! let _: Pin<&mut T> = rc.as_mut().get_pin_mut();
//!
//! // And here we have `&mut T` to the same data.
//! let shared: &RefCell = rc.into_ref().get_ref();
-//! let borrow = shared.borrow_mut();
+//! let mut borrow = shared.borrow_mut();
//! let content = &mut *borrow;
//! }
//! ```