@@ -588,11 +588,11 @@ impl<T: ?Sized> Arc<T> {
588
588
}
589
589
590
590
impl < T : ?Sized > Arc < T > {
591
- // Allocates an `ArcInner<T>` with sufficient space for
592
- // an unsized value where the value has the layout provided.
593
- //
594
- // The function `mem_to_arcinner` is called with the data pointer
595
- // and must return back a (potentially fat)-pointer for the `ArcInner<T>`.
591
+ /// Allocates an `ArcInner<T>` with sufficient space for
592
+ /// an unsized value where the value has the layout provided.
593
+ ///
594
+ /// The function `mem_to_arcinner` is called with the data pointer
595
+ /// and must return back a (potentially fat)-pointer for the `ArcInner<T>`.
596
596
unsafe fn allocate_for_unsized (
597
597
value_layout : Layout ,
598
598
mem_to_arcinner : impl FnOnce ( * mut u8 ) -> * mut ArcInner < T >
@@ -618,7 +618,7 @@ impl<T: ?Sized> Arc<T> {
618
618
inner
619
619
}
620
620
621
- // Allocates an `ArcInner<T>` with sufficient space for an unsized value
621
+ /// Allocates an `ArcInner<T>` with sufficient space for an unsized value.
622
622
unsafe fn allocate_for_ptr ( ptr : * const T ) -> * mut ArcInner < T > {
623
623
// Allocate for the `ArcInner<T>` using the given value.
624
624
Self :: allocate_for_unsized (
@@ -650,7 +650,7 @@ impl<T: ?Sized> Arc<T> {
650
650
}
651
651
652
652
impl < T > Arc < [ T ] > {
653
- // Allocates an `ArcInner<[T]>` with the given length.
653
+ /// Allocates an `ArcInner<[T]>` with the given length.
654
654
unsafe fn allocate_for_slice ( len : usize ) -> * mut ArcInner < [ T ] > {
655
655
Self :: allocate_for_unsized (
656
656
Layout :: array :: < T > ( len) . unwrap ( ) ,
@@ -659,19 +659,19 @@ impl<T> Arc<[T]> {
659
659
}
660
660
}
661
661
662
- // Sets the data pointer of a `?Sized` raw pointer.
663
- //
664
- // For a slice/trait object, this sets the `data` field and leaves the rest
665
- // unchanged. For a sized raw pointer, this simply sets the pointer.
662
+ /// Sets the data pointer of a `?Sized` raw pointer.
663
+ ///
664
+ /// For a slice/trait object, this sets the `data` field and leaves the rest
665
+ /// unchanged. For a sized raw pointer, this simply sets the pointer.
666
666
unsafe fn set_data_ptr < T : ?Sized , U > ( mut ptr : * mut T , data : * mut U ) -> * mut T {
667
667
ptr:: write ( & mut ptr as * mut _ as * mut * mut u8 , data as * mut u8 ) ;
668
668
ptr
669
669
}
670
670
671
671
impl < T > Arc < [ T ] > {
672
- // Copy elements from slice into newly allocated Arc<[T]>
673
- //
674
- // Unsafe because the caller must either take ownership or bind `T: Copy`
672
+ /// Copy elements from slice into newly allocated Arc<[T]>
673
+ ///
674
+ /// Unsafe because the caller must either take ownership or bind `T: Copy`.
675
675
unsafe fn copy_from_slice ( v : & [ T ] ) -> Arc < [ T ] > {
676
676
let ptr = Self :: allocate_for_slice ( v. len ( ) ) ;
677
677
@@ -735,7 +735,7 @@ impl<T> Arc<[T]> {
735
735
}
736
736
}
737
737
738
- // Specialization trait used for From<&[T]>
738
+ /// Specialization trait used for ` From<&[T]>`.
739
739
trait ArcFromSlice < T > {
740
740
fn from_slice ( slice : & [ T ] ) -> Self ;
741
741
}
@@ -1903,7 +1903,7 @@ impl<T, I: iter::TrustedLen<Item = T>> ArcFromIter<T, I> for Arc<[T]> {
1903
1903
1904
1904
impl < ' a , T : ' a + Clone > ArcFromIter < & ' a T , slice:: Iter < ' a , T > > for Arc < [ T ] > {
1905
1905
fn from_iter ( iter : slice:: Iter < ' a , T > ) -> Self {
1906
- // Delegate to `impl<T: Clone> From<&[T]> for Rc <[T]>`.
1906
+ // Delegate to `impl<T: Clone> From<&[T]> for Arc <[T]>`.
1907
1907
//
1908
1908
// In the case that `T: Copy`, we get to use `ptr::copy_nonoverlapping`
1909
1909
// which is even more performant.
0 commit comments