@@ -625,66 +625,4 @@ where
625
625
}
626
626
array
627
627
}
628
-
629
- #[ deprecated(
630
- note = "This method is hard to use correctly. Use `uninit` instead." ,
631
- since = "0.15.0"
632
- ) ]
633
- #[ allow( clippy:: uninit_vec) ] // this is explicitly intended to create uninitialized memory
634
- /// Create an array with uninitialized elements, shape `shape`.
635
- ///
636
- /// Prefer to use [`uninit()`](ArrayBase::uninit) if possible, because it is
637
- /// easier to use correctly.
638
- ///
639
- /// **Panics** if the number of elements in `shape` would overflow isize.
640
- ///
641
- /// ### Safety
642
- ///
643
- /// Accessing uninitialized values is undefined behaviour. You must overwrite *all* the elements
644
- /// in the array after it is created; for example using
645
- /// [`raw_view_mut`](ArrayBase::raw_view_mut) or other low-level element access.
646
- ///
647
- /// The contents of the array is indeterminate before initialization and it
648
- /// is an error to perform operations that use the previous values. For
649
- /// example it would not be legal to use `a += 1.;` on such an array.
650
- ///
651
- /// This constructor is limited to elements where `A: Copy` (no destructors)
652
- /// to avoid users shooting themselves too hard in the foot.
653
- ///
654
- /// (Also note that the constructors `from_shape_vec` and
655
- /// `from_shape_vec_unchecked` allow the user yet more control, in the sense
656
- /// that Arrays can be created from arbitrary vectors.)
657
- pub unsafe fn uninitialized < Sh > ( shape : Sh ) -> Self
658
- where
659
- A : Copy ,
660
- Sh : ShapeBuilder < Dim = D > ,
661
- {
662
- let shape = shape. into_shape_with_order ( ) ;
663
- let size = size_of_shape_checked_unwrap ! ( & shape. dim) ;
664
- let mut v = Vec :: with_capacity ( size) ;
665
- v. set_len ( size) ;
666
- Self :: from_shape_vec_unchecked ( shape, v)
667
- }
668
- }
669
-
670
- impl < S , A , D > ArrayBase < S , D >
671
- where
672
- S : DataOwned < Elem = MaybeUninit < A > > ,
673
- D : Dimension ,
674
- {
675
- /// Create an array with uninitialized elements, shape `shape`.
676
- ///
677
- /// This method has been renamed to `uninit`
678
- #[ deprecated( note = "Renamed to `uninit`" , since = "0.15.0" ) ]
679
- pub fn maybe_uninit < Sh > ( shape : Sh ) -> Self
680
- where Sh : ShapeBuilder < Dim = D >
681
- {
682
- unsafe {
683
- let shape = shape. into_shape_with_order ( ) ;
684
- let size = size_of_shape_checked_unwrap ! ( & shape. dim) ;
685
- let mut v = Vec :: with_capacity ( size) ;
686
- v. set_len ( size) ;
687
- Self :: from_shape_vec_unchecked ( shape, v)
688
- }
689
- }
690
628
}
0 commit comments