about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn-John Tedro <udoprog@tedro.se>2024-01-28 17:33:17 +0100
committerJohn-John Tedro <udoprog@tedro.se>2024-01-28 18:25:21 +0100
commitbdbbf04a03311a79a193196f7ac64e5fd164af44 (patch)
tree525a4a2fc521fd5923a52efe2ea3e7690ce7b2de
parenteebc7207579d06ccdb38bd79c01bec08f1c29bde (diff)
downloadrust-bdbbf04a03311a79a193196f7ac64e5fd164af44.tar.gz
rust-bdbbf04a03311a79a193196f7ac64e5fd164af44.zip
Fix doctest
-rw-r--r--library/alloc/src/rc.rs5
-rw-r--r--library/alloc/src/sync.rs5
2 files changed, 6 insertions, 4 deletions
diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs
index ebd816fba81..ca4ddaa92a5 100644
--- a/library/alloc/src/rc.rs
+++ b/library/alloc/src/rc.rs
@@ -1387,6 +1387,7 @@ impl<T: ?Sized, A: Allocator> Rc<T, A> {
     /// even if the returned `Rc<T>` is never accessed.
     ///
     /// [into_raw]: Rc::into_raw
+    /// [transmute]: core::mem::transmute
     /// [unsized coercion]: https://doc.rust-lang.org/reference/type-coercions.html#unsized-coercions
     ///
     /// # Examples
@@ -1419,11 +1420,11 @@ impl<T: ?Sized, A: Allocator> Rc<T, A> {
     /// use std::rc::Rc;
     /// use std::alloc::System;
     ///
-    /// let x: Rc<[u32]> = Rc::new_in([1, 2, 3], System);
+    /// let x: Rc<[u32], _> = Rc::new_in([1, 2, 3], System);
     /// let x_ptr: *const [u32] = Rc::into_raw(x);
     ///
     /// unsafe {
-    ///     let x: Rc<[u32; 3]> = Rc::from_raw_in(x_ptr.cast::<[u32; 3]>(), System);
+    ///     let x: Rc<[u32; 3], _> = Rc::from_raw_in(x_ptr.cast::<[u32; 3]>(), System);
     ///     assert_eq!(&*x, &[1, 2, 3]);
     /// }
     /// ```
diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs
index 96f8f57f9e0..9bf4881869e 100644
--- a/library/alloc/src/sync.rs
+++ b/library/alloc/src/sync.rs
@@ -1538,6 +1538,7 @@ impl<T: ?Sized, A: Allocator> Arc<T, A> {
     /// even if the returned `Arc<T>` is never accessed.
     ///
     /// [into_raw]: Arc::into_raw
+    /// [transmute]: core::mem::transmute
     /// [unsized coercion]: https://doc.rust-lang.org/reference/type-coercions.html#unsized-coercions
     ///
     /// # Examples
@@ -1570,11 +1571,11 @@ impl<T: ?Sized, A: Allocator> Arc<T, A> {
     /// use std::sync::Arc;
     /// use std::alloc::System;
     ///
-    /// let x: Arc<[u32]> = Arc::new_in([1, 2, 3], System);
+    /// let x: Arc<[u32], _> = Arc::new_in([1, 2, 3], System);
     /// let x_ptr: *const [u32] = Arc::into_raw(x);
     ///
     /// unsafe {
-    ///     let x: Arc<[u32; 3]> = Arc::from_raw_in(x_ptr.cast::<[u32; 3]>(), System);
+    ///     let x: Arc<[u32; 3], _> = Arc::from_raw_in(x_ptr.cast::<[u32; 3]>(), System);
     ///     assert_eq!(&*x, &[1, 2, 3]);
     /// }
     /// ```